Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp5103870ioo; Tue, 31 May 2022 20:28:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZgq+iQPhy6eKjJVlf4irU0Y0EMrA93bZRTHfolboW7ymymMQf28cgLc/7FyR9fMihXPOa X-Received: by 2002:a63:4853:0:b0:3fa:dc6:7ac2 with SMTP id x19-20020a634853000000b003fa0dc67ac2mr43899333pgk.298.1654054090046; Tue, 31 May 2022 20:28:10 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1654054090; cv=pass; d=google.com; s=arc-20160816; b=YWHtjbS1g8cUE0qB9mT+gEWcTzWhtofSKbZiyd4OPLrOKsicHxx3Sw/Z6unfAd28kz ROY96KVirjTsWsmO1LvHaWr0XD58mJrvbnhb8wZemCwJjRNZ48LE3hJ8G673ebjEhzj8 yNYfJI2t1/aXx6eaWBPwJpuOs/tAqjB4icDQqtrLKucf064M3cAZQ4ZH1xP34YE/s1WN iq1fnnQyO58hFl14phyQbOpvZECRvQ5Zr0fmAQARGR+fSco//9n50U0n3kaxqmEb8IuZ Id0IR1CnDT0Rcweb8KR4cieIJPfuMQdhzyMBn/aTo7P1436aOXFwfnQJ/nXc2aa7egH9 hYrw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=8Ln1IYHCrBrCaQS84rnoFBpWZLwjNyjzT+nTzcBkppU=; b=iJn3pyt6hcTImpjSaJU3tPPXWmadaGCVqYatR7K+gFMiUutcW9Vu9H8jCpn7TLJDj8 4+jPhaa47laPztUMBlK201RfrGOE2+wReKaSsjSuGbxmuuhDBCxiwacsl1OiomHOJVx2 ntAGttfbLTs3mFVXHvzRDfHRmbAMk9PFE1UXP8AI9g6+NFxbpm7XshnlRPoOcrJ3jqEe l7RIDMIuWRbZE4slXW0ldJOI6Lp+9/xGxW4xlUZubRi4SEAqx679B1IxjZ1cKlr+Q3lf mJuM64r60g+Uy8wY1Rjkeltg7mE+vbmKZmVbKdbH4cGOa3xeZ19waZzHevbXPDGSrVaV cfrw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=13ehhYFf; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b21-20020a170902d31500b00161f1960b5dsi985132plc.291.2022.05.31.20.27.56; Tue, 31 May 2022 20:28:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=13ehhYFf; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240413AbiE3OLt (ORCPT + 99 others); Mon, 30 May 2022 10:11:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239302AbiE3OFh (ORCPT ); Mon, 30 May 2022 10:05:37 -0400 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2078.outbound.protection.outlook.com [40.107.92.78]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3C8ECFE3C; Mon, 30 May 2022 06:41:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gWhkfLs65iVQv0+mt9DfStWvXbcYjJJ5myovjcMm7Ta3TEc8sSAcaV4LMo2zqgR+vBqlLNSmRFohsrgyUsInoYd5+DGRszdinu+j5JN+Xf2DodW8bD1gWPlFV+09sBT7KNW5tj5QK2Sh4oW6W7OvKobFwceAn2zhioyqZvp6ITO7GoCZru13szVhTy/SqLqdOzvnjDJEZPrsIEvj9MRDMvKZdmgVMSDX7TapjTXFLfMCDFS9t41YHC2Rt7uqLOXdqQX0y/hDmGh1BLsIY1BOr9PBEJm+YzyhdStVZuqHnFtbsI9ytqL41Qk48Xt7IXUHFv9zqx86VgkV+m6QsooteQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8Ln1IYHCrBrCaQS84rnoFBpWZLwjNyjzT+nTzcBkppU=; b=TbDgXJLIzJ1kD4HWYPsJhR7NFIxy3EhpXBGRzWXRJdA4R8akIE0mNkcsrvmfJAz4lulPj/sMPPQCa/9zrqiPCA+lhI0aTBQeVYGWHd0De7sUI2icHwV3YNIvWbvf7F6eexVOC6VIOcrzEFUQ4jUwj6+OZblwN/sO+6hsT8BfeLQMu2cBA7RslLAZK/5iloKeLLBiuNayQMhCPPCyoz4eHYyB6nJfv6m/A8/7UTuzzIieWcZh8zFnJvg1HxT0pvKs+4DKhFdae82/DR+biXmDn5S2wzlmCAtrhxEcYdanTas5gH0ADqC6dlTi+0rj+6RGs2XUqijMEibtP/AabWFOCA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8Ln1IYHCrBrCaQS84rnoFBpWZLwjNyjzT+nTzcBkppU=; b=13ehhYFfxSWwAGsLkIAQffpe4EG92IwRz4RVTkutxhpU6BCWdggdvfHywDUQDBskAdXfedmF+60Eub0upNf3famO8vYXRRxBpWsIgBxw8OR00s4Jvx8/Uaap5BBkXQrjccQMwNUdkxi+myiNcPi9scswbsI3ZxJspipPqOUWjAQ= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from BN8PR12MB3587.namprd12.prod.outlook.com (2603:10b6:408:43::13) by MW2PR12MB2441.namprd12.prod.outlook.com (2603:10b6:907:f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5293.13; Mon, 30 May 2022 13:41:26 +0000 Received: from BN8PR12MB3587.namprd12.prod.outlook.com ([fe80::7146:65ee:8fd3:dd03]) by BN8PR12MB3587.namprd12.prod.outlook.com ([fe80::7146:65ee:8fd3:dd03%4]) with mapi id 15.20.5293.019; Mon, 30 May 2022 13:41:25 +0000 Message-ID: <02e7946b-34ca-b48e-1ba6-e7b63740a2d9@amd.com> Date: Mon, 30 May 2022 15:41:13 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH v6 14/22] dma-buf: Introduce new locking convention Content-Language: en-US To: Dmitry Osipenko , David Airlie , Gerd Hoffmann , Gurchetan Singh , Chia-I Wu , Daniel Vetter , Daniel Almeida , Gert Wollny , Gustavo Padovan , Daniel Stone , Tomeu Vizoso , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Steven Price , Alyssa Rosenzweig , Rob Clark , Emil Velikov , Robin Murphy , Qiang Yu , Sumit Semwal , "Pan, Xinhui" , Thierry Reding , Tomasz Figa , Marek Szyprowski , Mauro Carvalho Chehab , Alex Deucher , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Dmitry Osipenko , linux-tegra@vger.kernel.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, amd-gfx@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, kernel@collabora.com References: <20220526235040.678984-1-dmitry.osipenko@collabora.com> <20220526235040.678984-15-dmitry.osipenko@collabora.com> <0a02a31d-a256-4ca4-0e35-e2ea1868a8ae@amd.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: AM6P193CA0085.EURP193.PROD.OUTLOOK.COM (2603:10a6:209:88::26) To BN8PR12MB3587.namprd12.prod.outlook.com (2603:10b6:408:43::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: c1ffce7a-8d23-4703-3cdb-08da42421776 X-MS-TrafficTypeDiagnostic: MW2PR12MB2441:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: iSW1wIoCn3nNFjZJBQ1vVHTV4DmbG7Pguh9zjakZuKfexezjAX9RzSr2q+jzbmy/pmZffq8/LpakTy5pBFcDAworhdC/7/i1vg8M76wK2hEcPOwrV+FPaB0gaA3b6ou5npDbyKmelZ9o+gLFGHSLYIU3WyrL1hcJOBI0x7269ze2XOmr65aRKKBRAOAKFE4eIofz0U1UsWLiaEW0mrxY+Ee15EUJ9ZYZ7ne4rzcGPgLsjOZfmF1QS+iCcpOmzeAI1mF0VzgjkT2h/p2o378+qIb0XPuGI0LsIwQne/y/bTWmX/uTsfwGfCD/X/eeNHuhGHUiawshG6purNZ3P/Gl01dBkomujtNqIs4WPJ4hS8GG22IvqjY7uC6dSKRf0cAq+4oyD/bzGNx4Q4Bov2KbPdu5eIkBJW6xmWZ06K5fQTS7KXP8+OlfnC761AirGjBvz7OEMdYQLCUVfPFRK07BX1r/misEdHCvyzWxfVu4F3iPlUe9On/qIFBrlz96lVC7reTmjbqZYQ1NIzFyNZhTvLrNDWr41V/dYj1meGasC4tGClUxRG/YlcJavEGJkX8mQDrlI/5fKT2RfGg6CU/wyQL9Tm6vuZ7hvtx8BOGDpoCXe1C3NpyFm0l0PU9dOkkHLMLsjlMILagVF1RYcItVWeef0wAN6sD52qXCXlEyWYwn5QL67/wSMGPmDIw7dy+c2nimlRzNxOJ1lrB1RZvmzLHGeK9QjXGqgL1dNa/xWsf/zWxEnElUKJib5NRQGmJm X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR12MB3587.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(508600001)(83380400001)(110136005)(66574015)(6666004)(6506007)(8936002)(7406005)(5660300002)(38100700002)(66476007)(66946007)(86362001)(26005)(66556008)(53546011)(186003)(7416002)(6486002)(36756003)(2616005)(8676002)(6512007)(31686004)(4326008)(31696002)(2906002)(921005)(316002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?L0pPUFVQVUgyMjFNaVg2cE5QdUJjWG5Xb3FTOUlsNUhlRjVkMSsyRGM0NTNr?= =?utf-8?B?TU8xbURXdlZSRXh2TnhlanJramY2R0V2VDIvR2VzVnVqTlRLbWdkMTlFVnhp?= =?utf-8?B?OG44WGpBd0pRaHd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dhMVM0M05P?= =?utf-8?B?M1RIQ1k1VE5MbUdhSHIyanBSdENHYTUwMWtTMjN0VndqVUl4REZBanV2V1hN?= =?utf-8?B?MzlueVd0dGZzM3M1MERRWlMyUStwTHpGbDczZ2JWMHhsd3NsaE93OTAyd2lW?= =?utf-8?B?WVFRdkJSdHpMSmxMWHZSYkw0ajZOWm5tRURiRnF4SWU3SUdNZ05VRDhCcWlF?= =?utf-8?B?Y0xycnVtejF1MXZWZ0p4Yzljem9KTzhJOXdMR3pLc1VMUEpwYjFYK0M0ZnA3?= =?utf-8?B?b2QycFAxTmJQUHRtRFcwcVM3dUFmUjgvamVsenVjM0pXb2lvSHJBMFA2RXBu?= =?utf-8?B?dS81TFRDK3ltdW1WSDF4b0x3K1lvNHZ5Zk40cEdRNCtSeGVFN2Z5cjBWQjZZ?= =?utf-8?B?eUVSU1c4eUErVUZwdVJlVXV4R1hxdElUOXJ1UEZyTHR4VEg2djdiQT09?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: c1ffce7a-8d23-4703-3cdb-08da42421776 X-MS-Exchange-CrossTenant-AuthSource: BN8PR12MB3587.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 May 2022 13:41:25.6964 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: bKlBf/nVEJ1X9nxM5Oz0JjeCcNh0J4+oP26sfpG5+KmhP4Sme4vWuenl2MB9dIje X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW2PR12MB2441 X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Dmitry, Am 30.05.22 um 15:26 schrieb Dmitry Osipenko: > Hello Christian, > > On 5/30/22 09:50, Christian König wrote: >> Hi Dmitry, >> >> First of all please separate out this patch from the rest of the series, >> since this is a complex separate structural change. > I assume all the patches will go via the DRM tree in the end since the > rest of the DRM patches in this series depend on this dma-buf change. > But I see that separation may ease reviewing of the dma-buf changes, so > let's try it. That sounds like you are underestimating a bit how much trouble this will be. >> I have tried this before and failed because catching all the locks in >> the right code paths are very tricky. So expect some fallout from this >> and make sure the kernel test robot and CI systems are clean. > Sure, I'll fix up all the reported things in the next iteration. > > BTW, have you ever posted yours version of the patch? Will be great if > we could compare the changed code paths. No, I never even finished creating it after realizing how much work it would be. >>> This patch introduces new locking convention for dma-buf users. From now >>> on all dma-buf importers are responsible for holding dma-buf reservation >>> lock around operations performed over dma-bufs. >>> >>> This patch implements the new dma-buf locking convention by: >>> >>>    1. Making dma-buf API functions to take the reservation lock. >>> >>>    2. Adding new locked variants of the dma-buf API functions for drivers >>>       that need to manage imported dma-bufs under the held lock. >> Instead of adding new locked variants please mark all variants which >> expect to be called without a lock with an _unlocked postfix. >> >> This should make it easier to remove those in a follow up patch set and >> then fully move the locking into the importer. > Do we really want to move all the locks to the importers? Seems the > majority of drivers should be happy with the dma-buf helpers handling > the locking for them. Yes, I clearly think so. > >>>    3. Converting all drivers to the new locking scheme. >> I have strong doubts that you got all of them. At least radeon and >> nouveau should grab the reservation lock in their ->attach callbacks >> somehow. > Radeon and Nouveau use gem_prime_import_sg_table() and they take resv > lock already, seems they should be okay (?) You are looking at the wrong side. You need to fix the export code path, not the import ones. See for example attach on radeon works like this drm_gem_map_attach->drm_gem_pin->radeon_gem_prime_pin->radeon_bo_reserve->ttm_bo_reserve->dma_resv_lock. Same for nouveau and probably a few other exporters as well. That will certainly cause a deadlock if you don't fix it. I strongly suggest to do this step by step, first attach/detach and then the rest. Regards, Christian. > > I assume all the basics should covered in this v6. At minimum Intel, > Tegra, Panfrost, Lima and Rockchip drivers should be good. If I missed > something, then please let me know and I'll correct it. > >>> Signed-off-by: Dmitry Osipenko >>> --- >>>   drivers/dma-buf/dma-buf.c                     | 270 +++++++++++------- >>>   drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c       |   6 +- >>>   drivers/gpu/drm/drm_client.c                  |   4 +- >>>   drivers/gpu/drm/drm_gem.c                     |  33 +++ >>>   drivers/gpu/drm/drm_gem_framebuffer_helper.c  |   6 +- >>>   drivers/gpu/drm/i915/gem/i915_gem_dmabuf.c    |  10 +- >>>   drivers/gpu/drm/qxl/qxl_object.c              |  17 +- >>>   drivers/gpu/drm/qxl/qxl_prime.c               |   4 +- >>>   .../common/videobuf2/videobuf2-dma-contig.c   |  11 +- >>>   .../media/common/videobuf2/videobuf2-dma-sg.c |  11 +- >>>   .../common/videobuf2/videobuf2-vmalloc.c      |  11 +- >>>   include/drm/drm_gem.h                         |   3 + >>>   include/linux/dma-buf.h                       |  14 +- >>>   13 files changed, 241 insertions(+), 159 deletions(-) >>> >>> diff --git a/drivers/dma-buf/dma-buf.c b/drivers/dma-buf/dma-buf.c >>> index 32f55640890c..64a9909ccfa2 100644 >>> --- a/drivers/dma-buf/dma-buf.c >>> +++ b/drivers/dma-buf/dma-buf.c >>> @@ -552,7 +552,6 @@ struct dma_buf *dma_buf_export(const struct >>> dma_buf_export_info *exp_info) >>>       file->f_mode |= FMODE_LSEEK; >>>       dmabuf->file = file; >>>   -    mutex_init(&dmabuf->lock); >> Please make removing dmabuf->lock a separate change. > Alright >