From patchwork Tue May 22 15:49:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrey Grodzovsky X-Patchwork-Id: 10419011 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CD37E60224 for ; Tue, 22 May 2018 15:49:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B96B528E2B for ; Tue, 22 May 2018 15:49:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ADFB628E2D; Tue, 22 May 2018 15:49:15 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED, RCVD_IN_SORBS_WEB autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 1EBE128E2B for ; Tue, 22 May 2018 15:49:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 112A26E2E1; Tue, 22 May 2018 15:49:13 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from NAM03-DM3-obe.outbound.protection.outlook.com (mail-dm3nam03on0058.outbound.protection.outlook.com [104.47.41.58]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3CAAD6E2D5 for ; Tue, 22 May 2018 15:49:11 +0000 (UTC) Received: from [172.27.230.118] (165.204.55.251) by MWHPR12MB1453.namprd12.prod.outlook.com (2603:10b6:301:e::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.776.11; Tue, 22 May 2018 15:49:08 +0000 Subject: Re: [PATCH 2/3] drm/scheduler: Don't call wait_event_killable for signaled process. To: =?UTF-8?Q?Michel_D=c3=a4nzer?= References: <87muxsbmkp.fsf@xmission.com> <8840ac96-50c4-f94d-eb7c-f007940163f3@amd.com> <877eowa5qh.fsf@xmission.com> <20180425135552.GD7592@redhat.com> <20180425171757.GA10441@redhat.com> <874ljyu98e.fsf@xmission.com> <20180430160006.GB10583@redhat.com> <79b2ce10-2cd7-b6f2-551e-0b4ae21072af@amd.com> <28de0150-0a31-f51a-4f56-0a71f741e07e@amd.com> <3ff3a5f4-c109-bf86-2772-9d88abc419df@amd.com> <662c84bf-ac38-db28-1a11-b17719c9b8d0@daenzer.net> <12c806f9-f283-5bed-d137-7719ba73205a@daenzer.net> From: Andrey Grodzovsky Message-ID: Date: Tue, 22 May 2018 11:49:02 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <12c806f9-f283-5bed-d137-7719ba73205a@daenzer.net> Content-Language: en-US X-Originating-IP: [165.204.55.251] X-ClientProxiedBy: YQBPR0101CA0054.CANPRD01.PROD.OUTLOOK.COM (2603:10b6:c00:1::31) To MWHPR12MB1453.namprd12.prod.outlook.com (2603:10b6:301:e::22) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(48565401081)(2017052603328)(7153060)(49563074)(7193020); SRVR:MWHPR12MB1453; X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1453; 3:o/hD9Lbd1ZcKwqFQzgrx49H05GZ2/IyGzc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Xi5lkYTiS1/4UVzoZ07x3BbWDzcwaIt4A00/VrwQZFn64fDH5jKC/owfK1CTXie83a7J5XCkGhJNbg3etrj2jb1bTQ3tJ31UuMDKP1oAa6ldWNu17PP2b7aBDb0vP7EG9Q7zlSD0Ca17TPPbDOw3T+OJjQKRhvOCuFKpI3qP8uFEBGC9lUVQ3ZYV3vEjosi/GkPea3jnHtOLU9qMTKDZ1LLdxNwVTMT2FEv047Zr/2lPVhKdY3xEeYM6dQxcuPazo7H7Xd/fIM4PIIygtZlvhN4flAenTsj/AuaOrYqFaB9FtEKUMaf; 4:3xn8K3tkvD5ABeIe8150ZVZ+dC9aiH5EtRpkfcxZBBcpbuAO4VXWwPY3q4CDyAdEy5BpcIC1bar+s+YKA8F6VVjfJOEMFnv10wYV4dzarsMEpwsY3q7hvfh0xuZ/gPjIoto6k36pRz7wFLHNp01E836+zKIjBtjcYAL0GaGmFuYdHDxdIKTq1l0xejdleSdmXbCRPMmJYxdHwR7ogorgtCOLIv07uvhIQLOGmrzEAUDsdA2JOrHR7C5KUGSP5+BNFcIXb6FkL5HY/1w+KU/Hb5HdG8eNvE5wCcpdrEZpQ3yg7XBCH52GoGnwPiXhOMQh X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(158342451672863); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(102415395)(6040522)(2401047)(8121501046)(5005006)(3231254)(944501410)(52105095)(3002001)(10201501046)(93006095)(93001095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123558120)(20161123564045)(6072148)(201708071742011)(7699016); SRVR:MWHPR12MB1453; BCL:0; PCL:0; RULEID:; SRVR:MWHPR12MB1453; X-Forefront-PRVS: 0680FADD48 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6049001)(366004)(39380400002)(376002)(396003)(39860400002)(346002)(377424004)(52314003)(54094003)(51914003)(199004)(189003)(68736007)(65826007)(316002)(31696002)(16526019)(186003)(2476003)(97736004)(7736002)(5660300001)(305945005)(77096007)(386003)(53546011)(8936002)(8676002)(26005)(81156014)(81166006)(93886005)(86362001)(64126003)(76176011)(16576012)(33964004)(52116002)(229853002)(37036004)(270700001)(6486002)(54906003)(16586007)(58126008)(2906002)(3846002)(6116002)(568964002)(6666003)(6916009)(31686004)(36756003)(4326008)(5890100001)(84326002)(486006)(476003)(956004)(11346002)(105586002)(65956001)(66066001)(65806001)(2616005)(478600001)(6246003)(72206003)(106356001)(25786009)(4610100001)(446003)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR12MB1453; H:[172.27.230.118]; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR12MB1453; 23:DpEagAgn96TesvPqVSkzdhK79YUdqdxuTsvDyh8AT?= =?us-ascii?Q?z2lxDk6myRhyJkUvDZNC9p8vPrJgyKIgsJSGDe5xkSE5pmypSJ7aaVv8299U?= =?us-ascii?Q?RMSvZZzysE9hsw1Vc+hHKSpkk36ftXY3qazYbEpaNxWslbTI6OCi31SwX866?= =?us-ascii?Q?+AoX3qjd0LCwX2QjFIgLmbW7cITmi2RRngjaTm+8AcNJmsP9L9U8JbfSIl5F?= =?us-ascii?Q?L6ojgW5ntWXCMKR4MoYIm/m82Ql1zkiYU8HZsd20tl5+G++MtQLqBw9qFZyU?= =?us-ascii?Q?ykcABkmdqwVzWaFn2aTHfIdNTM1OPbLd8MtwI27+0yVj3P7nFHuWd/VzReTw?= =?us-ascii?Q?YfuKNLch5926cHfhIKLVXUpIrEKGsoDDFbCoDszVsuh4tr5ZvLt+sMlwkdsc?= =?us-ascii?Q?umFfcAbdGgfG4wTZecDvxC8lJdu90SFT9T/6QZoNdxIZBzOk1l0Ek3ouzQWr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bXtV2+aeR33y1PW4itlQXx02ZaGZQbxr5qaaAg==; 5:IEsaCBUUXPJoxDcnkqTM+1C2nCfA1nvVeIkDJ5Stza2sm0UBV8dLBpwVQGve8yCe4ZXljQos9U1gt0QtYG1rBD6QaQvei3dO/9d7XFWrrIoR5o2ZA1EQ1rZ0+sY7EqZU//ZwL+gn2SZdY/r57OVILwWkuGWpyvEF6NyBjILIYOg=; 24:KUrEHV/IAbHfzx23XL+nvnMETG5G5HHYUbFon0BN4f22wr8iLFzocuwJN5WhPh2CAUoRY4yjN/gq5mfJXoWofrabelMrfSPJsYUXN37KWDI= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1453; 7:XaFbHKFWZxNizvhOwpKp+AT6cg/8mBh8NutWF3JrSNpI8sFeotHK9bmJ5FqjjArxmnP80YI0yFRnhcO6Y9+eOsmTLxw8XVfWIt3bEdwxmCbdY1gFPPUUcsOO7ifW7fkrffycY/sqa1+k5lm75R8RryhnTjuF1mM/4gU4gB2Tma4PC1aVddC/3XeMVQXp/mIddfx/d2XzKRo1mphAPBP1NKmmQCN4jyXg0lSEo0sLSBPFsYzMWkafqLGLse/VEX1b; 20:8z0bPveKJVMcJ6Qq1MlQ2yVzl1zLQEhb7TZxMePDVg/pUiOp+D2/RB+zCxwKSMI0myVMYl7Snz5mfz9YNa3OSeSTZIv09rwlhQDqZNIi5vuGTY/lGOFCyRHjZLxrXT0ooAOB3XE6YOGGKUzdndPVygo2g5NoU91RNSuw156gC+ZvN3nyP9j/KQmAQ4JXIaApl54Cf0MQUp7dLvtI5lGhhcoOOXQ7DDkZLFbJSG3u53w8VHZM73GSScyCmkQQwrIa X-MS-Office365-Filtering-Correlation-Id: 4c9d3cf1-f9fa-44d7-df30-08d5bffb8ead X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 May 2018 15:49:08.7061 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4c9d3cf1-f9fa-44d7-df30-08d5bffb8ead X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1453 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Koenig, Christian" , ML dri-devel Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP On 05/18/2018 04:46 AM, Michel Dänzer wrote: > On 2018-05-17 09:05 PM, Andrey Grodzovsky wrote: >> On 05/17/2018 10:48 AM, Michel Dänzer wrote: >>> On 2018-05-17 01:18 PM, Andrey Grodzovsky wrote: >>>> Hi Michele and others, I am trying to implement the approach bellow to >>>> resolve AMDGPU's hang when commands are stuck in pipe during process >>>> exit. >>>> >>>> I noticed that once I implemented the file_operation.flush callback >>>> then during run of X, i see the flush callback gets called not only for >>>> Xorg process but for other >>>> >>>> processes such as 'xkbcomp' and even 'sh', it seems like Xorg passes his >>>> FDs to children, Christian mentioned he remembered a discussion to >>>> always set FD_CLOEXEC flag when opening the hardware device file, so >>>> >>>> we suspect a bug in Xorg with regard to this behavior. >>> Try the libdrm patch below. >>> >>> Note that the X server passes DRM file descriptors to DRI3 clients. >> Tried it, didn't help. I still see other processes calling .flush for >> /dev/dri/card0 > Try the attached xserver patch on top. With these patches, I no longer > see any DRM file descriptors being opened without O_CLOEXEC running Xorg > -pogo in strace. Thanks for the patch, unfortunately this is my first time  building xorg form source and I hit some blocks with dependencies. I wonder if you could quickly apply to amdgpu the attached small patch and run xinit from command line. In case the FD is not passed any more you will only see Xorg print in dmeg afterwards, otherwise 'sh' and 'xkbcomp' will also get printed. Andrey > > Anyway, the kernel can't rely on userspace using O_CLOEXEC. If the flush > callback being called from multiple processes is an issue, maybe the > flush callback isn't appropriate after all. > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index b0bf2f2..1f63712 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -855,9 +855,18 @@ static const struct dev_pm_ops amdgpu_pm_ops = { .runtime_idle = amdgpu_pmops_runtime_idle, }; +static int amdgpu_flush(struct file *f, fl_owner_t id) { + + DRM_ERROR("%s\n", current->comm); + + return 0; +} + + static const struct file_operations amdgpu_driver_kms_fops = { .owner = THIS_MODULE, .open = drm_open, + .flush = amdgpu_flush, .release = drm_release, .unlocked_ioctl = amdgpu_drm_ioctl, .mmap = amdgpu_mmap,