From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 850E4C4363C for ; Wed, 7 Oct 2020 19:33:22 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1CEDB207EA for ; Wed, 7 Oct 2020 19:33:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=intel-com.20150623.gappssmtp.com header.i=@intel-com.20150623.gappssmtp.com header.b="N8r/yrLD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1CEDB207EA Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 41F436E904; Wed, 7 Oct 2020 19:33:21 +0000 (UTC) Received: from mail-ej1-x642.google.com (mail-ej1-x642.google.com [IPv6:2a00:1450:4864:20::642]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2C49C6E904 for ; Wed, 7 Oct 2020 19:33:20 +0000 (UTC) Received: by mail-ej1-x642.google.com with SMTP id u8so4675580ejg.1 for ; Wed, 07 Oct 2020 12:33:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RmnEZ1FdPT1UPs7kQcpuXD7GC8rLG+yumUNPCpNpOGc=; b=N8r/yrLDPKroMQCnakJtgQlEsxQFffAa7XjZXv3NwJKYhW6cGY3P32N/wys8kUmeLc Z3cf4MV0FjcxNYHuUtP7Oj2/h/K2d2euOJU/PSS52ypyRDR0EBh1cJO1YDWaJVba6fQ/ H6alqkWn1zpA9cwsKPV0dohBNC66x1N6cRfq2ZiKrJCwD803V9/8UX+b9D3jMVPIj2FY NiVc6lfVxwhoQC3sLujKgSkr8KPyal/ezBglcD4d9hDhYk/CQ3pPnvtXwA7Ku8FHDzUO W0Kvwl/89Un3CcMfnS9Y//x9EccKgDRIV41sKknRM3LIym9lfBoDuNoTYkQr+aKovhyr Mbmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RmnEZ1FdPT1UPs7kQcpuXD7GC8rLG+yumUNPCpNpOGc=; b=P5TDu5hU751iIF5arx08qvpDei6ZpQs3zsXB32GYXt4cxtyJGr+sVs1r3oc7BdswrY CH0GlWdiW0WEkogYFucqgoqm5ryOnofNOzJmWNZcJSqxQzwun07Veo/+Rf2mciLVQ2Bj uqx/Qvcr8xNa3TVKZfFTsaTjrZavHP73aDsR+jlFhTYpZ5HK4QwIO5X1FQ5rpO7dACMH k37SmhQCV6xI9hBGDBze5qtf6ddwCIycvuxhhDVNEfluC25bxbWe1iXW5ydL00cTLoKI Kc91G3ttAE6JzA/xC7Yk42pGh6eX/eYtNe1DWgWLNYXQGR6p6a3hUzAccK7vmNrsEovV bOTQ== X-Gm-Message-State: AOAM532nJX4Uj7ENgXDPHWeoiOUdTeKXZw/6CAWd1HYMw5lCbsIQEMfM kqDaxE+622aathOsT8ubo/PaZ2t9pYwPY41strYsX87U8hk= X-Google-Smtp-Source: ABdhPJwxGpDKjE8M6aFCtzChdIqpmhlJGveNVqW3bvq/Ql2n/UAIW/iMsi5CJ7xIyexOlAXnBF03c4LTBSDYYkOBolI= X-Received: by 2002:a17:906:1a0b:: with SMTP id i11mr4984968ejf.472.1602099198813; Wed, 07 Oct 2020 12:33:18 -0700 (PDT) MIME-Version: 1.0 References: <20201007164426.1812530-1-daniel.vetter@ffwll.ch> <20201007164426.1812530-11-daniel.vetter@ffwll.ch> In-Reply-To: <20201007164426.1812530-11-daniel.vetter@ffwll.ch> From: Dan Williams Date: Wed, 7 Oct 2020 12:33:06 -0700 Message-ID: Subject: Re: [PATCH 10/13] PCI: revoke mappings like devmem To: Daniel Vetter X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-s390 , linux-samsung-soc , Jan Kara , Kees Cook , KVM list , Jason Gunthorpe , John Hubbard , LKML , DRI Development , Linux MM , =?UTF-8?B?SsOpcsO0bWUgR2xpc3Nl?= , linux-pci@vger.kernel.org, Bjorn Helgaas , Daniel Vetter , Andrew Morton , Linux ARM , "Linux-media@vger.kernel.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Wed, Oct 7, 2020 at 11:11 AM Daniel Vetter wrote: > > Since 3234ac664a87 ("/dev/mem: Revoke mappings when a driver claims > the region") /dev/kmem zaps ptes when the kernel requests exclusive > acccess to an iomem region. And with CONFIG_IO_STRICT_DEVMEM, this is > the default for all driver uses. > > Except there's two more ways to access pci bars: sysfs and proc mmap > support. Let's plug that hole. Ooh, yes, lets. > > For revoke_devmem() to work we need to link our vma into the same > address_space, with consistent vma->vm_pgoff. ->pgoff is already > adjusted, because that's how (io_)remap_pfn_range works, but for the > mapping we need to adjust vma->vm_file->f_mapping. Usually that's done > at ->open time, but that's a bit tricky here with all the entry points > and arch code. So instead create a fake file and adjust vma->vm_file. I don't think you want to share the devmem inode for this, this should be based off the sysfs inode which I believe there is already only one instance per resource. In contrast /dev/mem can have multiple inodes because anyone can just mknod a new character device file, the same problem does not exist for sysfs. _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel