Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp77201imw; Mon, 4 Jul 2022 05:35:32 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vr3xfEiFYf2TT5oFUKJ0159MMUpfPxDUN0appxaiBNNwQOtl/Cu3fjT9XFFamROHSDsqe9 X-Received: by 2002:a05:6402:40ca:b0:439:6b10:daa0 with SMTP id z10-20020a05640240ca00b004396b10daa0mr26292601edb.387.1656938132317; Mon, 04 Jul 2022 05:35:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1656938132; cv=pass; d=google.com; s=arc-20160816; b=P0oWR6xpwlVMJz5w7gltUZhaVJHzWoNZzTtsjsQDrhEfR7XAHP3rwTzJqSM02qkTQ9 dkSSgdpv3hHxMK2uU1RKEHSWPo4qiXVl9f9pP1rgvKPT1P/8CV+92c5/lgwXNtBSZQgP GbH1rAXFcUL6KzLrIYscqX4XP2lrZ8XGljChAeppdOK5yHo9JpsGVnYXYBCyx5tzx/YL QAG69eI5H65l3tsGAFoG6DFS4lBi/6ldj80KCxd5jxONzhuhL485v0DHgJins3hUwk8P 7XOw5V+2QqVjQPhpvuvoOmsytUjTP8nekTuSLQ80drjfe7s1ImILFbNpwDDtIRMrp+/t bBIA== 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=jbgHmTXn3+v9HYnad/3V1STrJHMw0NYfwlfzJZmXFrY=; b=i2SgLV13lbNrjhcminWnub/l4xJCzeA39MZsreR6NaABkyZV+xCrsL+cijeVpsWHbP CqQDQe52V2a76Hb9k4ZMSBl8o1T65SLo1/OKNnJPpe9nebIBy2CeaMVztYI4RHul3GJ6 XmN55MwTmnOIXuTmg/ZTqFCeb55vYndkpfS/oj3mH7a96kWrvHT++jjocykPkQEWbL28 2qNoQ/wktlNPCbm8V0lfDrS9Ei8DHAy5HoxCZLn5xYJAnEZDVZz0i3Q2K/8tdoQZHpfr 0JKRzqEpaT9yRLrYcM3ETrMPbqUXdHdX5WD73S49WjbPZVnyct+MQeq3FZMEnVzXfDxF 0iRg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=zQR+G2iC; 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 x4-20020a05640226c400b00435adb7520asi10019802edd.338.2022.07.04.05.35.06; Mon, 04 Jul 2022 05:35:32 -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=zQR+G2iC; 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 S234466AbiGDMdi (ORCPT + 99 others); Mon, 4 Jul 2022 08:33:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234237AbiGDMdd (ORCPT ); Mon, 4 Jul 2022 08:33:33 -0400 Received: from NAM02-DM3-obe.outbound.protection.outlook.com (mail-dm3nam02on2061.outbound.protection.outlook.com [40.107.95.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1EB12BA2; Mon, 4 Jul 2022 05:33:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=oFraxbJhleDVBejT3KW/IEdYzm6Tor2Mu9dbpd1oi3lgHnrsWZYrbYVrTT59Ein22/EqW/2u8APv4oDg5UqqJkmObjR+34PyzXZwfIR+/SIjBctQacttQSVxngKt3NPyEqjyhgp7HNwNU/DR4qGpowtmPZqo7Bv5fEVnOtSDVzzklXhZt9KHRafrHlmfX3cRVZ8QI0C7z6G7kTzbO/g5rlV9U+dtjR95l+nJ+KNzOR+6RTPUNKgb4wMR3NtsUMK0KQK2lFU4GMBnKlt24UqalTumj+ONq8GD1buEyjgx6xeEwKsEUCLC5KtG3I7dZaQxyB8JGVP92CMVgyUu3H/BDQ== 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=jbgHmTXn3+v9HYnad/3V1STrJHMw0NYfwlfzJZmXFrY=; b=hz1D0s3084dXOZl3GF6yqlkEd++akO9m4foqbnh+UwjCjl9rIU4STbqD2xBXHUe4W22SVzO7BJwdjijOMICb0AY5it4s4fHnf3sdsQjesyhui02kUYl7oChUMNM5J9EF0oXyKmNB3fLwuKZmiZkzH230U8jaOLfDQHSrEkP3FMZBuZs+VweaJywK/gcbZv0dDIl/hPuFHnAO/89xi249tomhHWOlTNw4Z3TAGPb/PSkS59YAmZe7Q1WQzj7w9Ro8Ug2B74eGhoQ4HpAJ9cHSHd+4e6alrvhuRSEpq9k07Mqv5Biv3XUMrhDdOVnGEatCRcYJ9ezqbbPK/CwBpkUSvg== 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=jbgHmTXn3+v9HYnad/3V1STrJHMw0NYfwlfzJZmXFrY=; b=zQR+G2iCvEhg78uVhMePel3JXalIkLupTtTyvt2Elr1FirATQP948T5/VeLpFzI37vqHmcRTc5UFeuyn2qBxlYmJhqOcNiELWSP2JZCUZyM/RTHNn/3XNETvyCaycBJDuchpxh8koCRO8SzKqAmcPpcjLKurCq5cACLiJ36iXGs= 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 MW3PR12MB4570.namprd12.prod.outlook.com (2603:10b6:303:5f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5395.15; Mon, 4 Jul 2022 12:33:29 +0000 Received: from BN8PR12MB3587.namprd12.prod.outlook.com ([fe80::905:1701:3b51:7e39]) by BN8PR12MB3587.namprd12.prod.outlook.com ([fe80::905:1701:3b51:7e39%2]) with mapi id 15.20.5395.020; Mon, 4 Jul 2022 12:33:29 +0000 Message-ID: <0335814b-dc11-4a54-9f24-bb4e9dbef35c@amd.com> Date: Mon, 4 Jul 2022 14:33:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [Linaro-mm-sig] Re: [PATCH v6 02/22] drm/gem: Move mapping of imported dma-bufs to drm_gem_mmap_obj() Content-Language: en-US To: Dmitry Osipenko , =?UTF-8?Q?Thomas_Hellstr=c3=b6m_=28Intel=29?= Cc: intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, virtualization@lists.linux-foundation.org, linaro-mm-sig@lists.linaro.org, amd-gfx@lists.freedesktop.org, linux-tegra@vger.kernel.org, Dmitry Osipenko , kernel@collabora.com, linux-media@vger.kernel.org, David Airlie , Gerd Hoffmann , Gurchetan Singh , 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 <"emil.l.veli kov"@gmail.com>, Robin Murphy , Qiang Yu , Sumit Semwal , =?UTF-8?Q?Christian_K=c3=b6nig?= , "Pan, Xinhui" , Thierry Reding , Tomasz Figa , Mauro Carvalho Chehab , Alex Deucher , Jani Nikula , Joonas Lahtinen , Rodrigo Vivi , Tvrtko Ursulin References: <20220526235040.678984-1-dmitry.osipenko@collabora.com> <20220526235040.678984-3-dmitry.osipenko@collabora.com> <467a1cee-ba8c-98f3-0398-2a7a5a90b5c3@collabora.com> From: =?UTF-8?Q?Christian_K=c3=b6nig?= In-Reply-To: <467a1cee-ba8c-98f3-0398-2a7a5a90b5c3@collabora.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: FR0P281CA0094.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:a9::14) 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: 02f79fa1-b173-4a91-0a85-08da5db96648 X-MS-TrafficTypeDiagnostic: MW3PR12MB4570:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LqM9tTqsq1qNBqPrPBfeqULoxXfM7jDY/dFSkJliTiMLOdISylOSsJMz0OGMbWpJK45+sQRXb00W7H23YnobVm+W8COMnUyXE9A2334GWNbcCS8fadxdOhtwxBVyis4oZOn2TnCjCs1QWhWmr4hgNj4VKVBUyCgHmgwylTkyYV1ruFHYHNBXtl1LtOLQFjzwmOq7hWWU96Vf42og6zaXhcU39XvRYB32z/mYE7X2535rcYQnmlEUid63ZH/ivQQBQOtChJr/Sz3/10wLuYbTQwj43+bFEpnHw25bcFOeLGYYSTh+JxrjCkDp03MOw4BXkT3XRxiRHwfP6/0R5f6mT9pPQynB7Zp6Eh1vy1lYnvmhkh8nvHl2r1J2Rl9xP8JtnbcgpmybQRiQZOw+mklZh4u1YUCI/s7PcQzY4RDRdzHzTgLU9FOWJD68N5O/XTQ6Y5BajB8D6iN6Wdo5axSOdiI19nRv+fCwh1d6jAt06jsRhQKQkSQXfUEkuTBNObyLUPRwl1jbYa3Y3X5bc4ZI20TjVWzSrFHiP50nBgrlPkHi0r3C0GZk6ColTaCdr8A9RczsGYl93NRazQtNt2E6krwIXem/0AxaLEgquHal7jkU8C/nmeAR7mlvdUJlMRMm2bGETb9gqDx9GiXEeMw9VFk/zklUQeSwelTA1a/7+5bLivaiFB4KmSyhtI90Tqu5PXfcoAbfnB2gg9+r04l1U9YJ/YqDUbrCP7Jb00z7rmESLf/OPJBk/gq0u3yeWGU+DlzFugU4XBk9dSZojY/1gOf/OpavThcBp0n5X+0U7fWoxM1XakpZh2XYiISdUO2RwtBdXge8d6Of71uHODXOq+iGCCTlBB/wIsiR281noDQ= 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:(13230016)(4636009)(376002)(346002)(39860400002)(136003)(366004)(396003)(6512007)(6486002)(478600001)(66946007)(66476007)(66556008)(316002)(54906003)(110136005)(8676002)(7406005)(5660300002)(36756003)(31686004)(7416002)(8936002)(6506007)(53546011)(2906002)(2616005)(4326008)(86362001)(31696002)(66574015)(186003)(83380400001)(38100700002)(41300700001)(6666004)(43740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lXbWpxYk5BMkhsWjREV2Vrd0RiSjJycUg1Zk9D?= =?utf-8?B?SFgxUHB3dUplOG4vWlZ0UkRYRkhDWWVuazg3TFphREswSCtvQjVlOHg4QWxB?= =?utf-8?B?TmNjRzh1S1JLMHo0MTRuUTVCTG5BTFB3S29TQVkrbVhoeU5MQ25heXorY0Ry?= =?utf-8?B?em9HQklwaGJaQTU2cWE0dFJJNzdPWi9VRVF4b2doWjRLdUwxVzhIbTc2L24y?= =?utf-8?B?OTJSa2Yrd2x3TXpPcHNsS3lLelN6OVgvcE5ISUZPcUxITlQ4Tmw0TWNVZDVI?= =?utf-8?B?RmRKWTc4d1JSbFN1K3ZGL3dCRzJvVTNybVFEa09ON25pSUNKVFZ1YlhnL09s?= =?utf-8?B?T28rL3FQSlZxUVFzOXdGZWp0UmhvTmRvWUlGdXJKT1E5Q2FSckxhcDFYYXBZ?= =?utf-8?B?K3QvWHhUU0JjUm9MeWU2MnEzZ2ZZdUY3YzRWbE5pQzQ5N3ZyWGtoVWdnTkJ3?= =?utf-8?Q?5mVXfs7A2BtRTpaDL9AHgWfHfHL3fAqBbEUXDLGOg4eJ?= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-Network-Message-Id: 02f79fa1-b173-4a91-0a85-08da5db96648 X-MS-Exchange-CrossTenant-AuthSource: BN8PR12MB3587.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Jul 2022 12:33:29.5801 (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: kBFwRfZ7S+Sw+Y8ldEK4wFdvCCjNTtRSBt0dRwaOuHWKymgM6p6Una73A6CCTvGb X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4570 X-Spam-Status: No, score=-2.1 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 Am 30.06.22 um 01:06 schrieb Dmitry Osipenko: > On 6/29/22 11:43, Thomas Hellström (Intel) wrote: >> On 6/29/22 10:22, Dmitry Osipenko wrote: >>> On 6/29/22 09:40, Thomas Hellström (Intel) wrote: >>>> On 5/27/22 01:50, Dmitry Osipenko wrote: >>>>> Drivers that use drm_gem_mmap() and drm_gem_mmap_obj() helpers don't >>>>> handle imported dma-bufs properly, which results in mapping of >>>>> something >>>>> else than the imported dma-buf. For example, on NVIDIA Tegra we get a >>>>> hard >>>>> lockup when userspace writes to the memory mapping of a dma-buf that >>>>> was >>>>> imported into Tegra's DRM GEM. >>>>> >>>>> To fix this bug, move mapping of imported dma-bufs to >>>>> drm_gem_mmap_obj(). >>>>> Now mmaping of imported dma-bufs works properly for all DRM drivers. >>>> Same comment about Fixes: as in patch 1, >>>>> Cc: stable@vger.kernel.org >>>>> Signed-off-by: Dmitry Osipenko >>>>> --- >>>>>    drivers/gpu/drm/drm_gem.c              | 3 +++ >>>>>    drivers/gpu/drm/drm_gem_shmem_helper.c | 9 --------- >>>>>    drivers/gpu/drm/tegra/gem.c            | 4 ++++ >>>>>    3 files changed, 7 insertions(+), 9 deletions(-) >>>>> >>>>> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c >>>>> index 86d670c71286..7c0b025508e4 100644 >>>>> --- a/drivers/gpu/drm/drm_gem.c >>>>> +++ b/drivers/gpu/drm/drm_gem.c >>>>> @@ -1038,6 +1038,9 @@ int drm_gem_mmap_obj(struct drm_gem_object *obj, >>>>> unsigned long obj_size, >>>>>        if (obj_size < vma->vm_end - vma->vm_start) >>>>>            return -EINVAL; >>>>>    +    if (obj->import_attach) >>>>> +        return dma_buf_mmap(obj->dma_buf, vma, 0); >>>> If we start enabling mmaping of imported dma-bufs on a majority of >>>> drivers in this way, how do we ensure that user-space is not blindly >>>> using the object mmap without calling the needed DMA_BUF_IOCTL_SYNC >>>> which is needed before and after cpu access of mmap'ed dma-bufs? >>>> >>>> I was under the impression (admittedly without looking) that the few >>>> drivers that actually called into dma_buf_mmap() had some private >>>> user-mode driver code in place that ensured this happened. >>> Since it's a userspace who does the mapping, then it should be a >>> responsibility of userspace to do all the necessary syncing. >> Sure, but nothing prohibits user-space to ignore the syncing thinking >> "It works anyway", testing those drivers where the syncing is a NOP. And >> when a driver that finally needs syncing is tested it's too late to fix >> all broken user-space. >> >>>   I'm not >>> sure whether anyone in userspace really needs to map imported dma-bufs >>> in practice. Nevertheless, this use-case is broken and should be fixed >>> by either allowing to do the mapping or prohibiting it. >>> >> Then I'd vote for prohibiting it, at least for now. And for the future >> moving forward we could perhaps revisit the dma-buf need for syncing, >> requiring those drivers that actually need it to implement emulated >> coherent memory which can be done not too inefficiently (vmwgfx being >> one example). > Alright, I'll change it to prohibit the mapping. This indeed should be a > better option. Oh, yes please. But I would expect that some people start screaming. Over time I've got tons of TTM patches because people illegally tried to mmap() imported DMA-bufs in their driver. Anyway this is probably the right thing to do and we can work on fixing the fallout later on. Regards, Christian.