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.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 72862C4361B for ; Fri, 18 Dec 2020 19:21:01 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D540223B85 for ; Fri, 18 Dec 2020 19:21:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D540223B85 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 2F55B6B005C; Fri, 18 Dec 2020 14:21:00 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2A7C66B005D; Fri, 18 Dec 2020 14:21:00 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 196B66B0068; Fri, 18 Dec 2020 14:21:00 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0006.hostedemail.com [216.40.44.6]) by kanga.kvack.org (Postfix) with ESMTP id 00CF46B005C for ; Fri, 18 Dec 2020 14:20:59 -0500 (EST) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id AFB19363B for ; Fri, 18 Dec 2020 19:20:59 +0000 (UTC) X-FDA: 77607370638.30.sea45_0b038d52743f Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin30.hostedemail.com (Postfix) with ESMTP id 9158C180B3C8E for ; Fri, 18 Dec 2020 19:20:59 +0000 (UTC) X-HE-Tag: sea45_0b038d52743f X-Filterd-Recvd-Size: 4908 Received: from mail-ej1-f49.google.com (mail-ej1-f49.google.com [209.85.218.49]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Fri, 18 Dec 2020 19:20:58 +0000 (UTC) Received: by mail-ej1-f49.google.com with SMTP id 6so4799958ejz.5 for ; Fri, 18 Dec 2020 11:20:57 -0800 (PST) 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=2HEr0MPReqXsQ4qjOEHDWj7dDqEmzb7cQ1SBc7J5+dw=; b=0gUyIB6kwj5RKOw851fk6tIuNDG4efEdNNdTwLooyi3Ofm0EJNVeG9KuAjSj3aMg6f Nwg+eoJoWVdwLtTY3Y8taw8Fef0vS6Q+iXd/8DHKpkBDllC+QxxTWM+tmflFQ56pKF9B r2XxuUfLtlwWmeTgBIAJmw9ETjSzKJTBTFdP2PkwnVqnR01L9FpICe97GYFCb2DWdW5K seQ68bOOeWzb3UjT1JmBfrvoBnu9/DfF7C6IExaFWhrhWglsaMg1lwmZ33uUG9d1/Sb+ XYVWsgUrBCaZCqgbA6uAiGkasFBAenXSTwAqf6Hsd5Vrz7GPCAPk7LmnxkGUwVTkpXZL KpAw== 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=2HEr0MPReqXsQ4qjOEHDWj7dDqEmzb7cQ1SBc7J5+dw=; b=V5s5eRhk60NRnIYx4EKfiVmXCpde5CGAOTHvYp893fDoScasP9CWodKMgYS390tutZ oOvaZ/g+HWURgFxu32CLobiu0ejoPeeKCmczZ43Mm+4B6J0zzjIi0NmF2fX/ZfZrY59S lP7kpEoBp/L68TWcPZCAwAlknukqpChfmZRD8G8z6u2a5hgzb1JhEBjg4Cw3Bki7CJeR Wr7shbO/+43pJvipPZVFsGc8UEcs82F7rrRMwIBxreSxZ20lZN9R/CIY6aezWBtE8xZv pZ6PxCqPa2FmW9uvIrBC0Ax7OxkvPYCK1VFyTLl6t8GU1UbB5L/GgkroLP/7BiBGuMB1 sKDA== X-Gm-Message-State: AOAM5334ZqEj6jiNS+mN/d/BbiEuhJRaxvizJ5MnTCx/ubr1/lkEurfZ SLg82q0ZftaFY3zM5RmvUlFLnPrpzuC+VF/VFUaXPQ== X-Google-Smtp-Source: ABdhPJxz1FpFcD9v7zRsD1EJK/j02c+zOqLAfDerue66a4zrExXDdPTJUW4Jq8q7kbLcuvcZiWDBKJ5jeXELTUS5XC8= X-Received: by 2002:a17:906:4146:: with SMTP id l6mr5459331ejk.341.1608319255787; Fri, 18 Dec 2020 11:20:55 -0800 (PST) MIME-Version: 1.0 References: <20201106232908.364581-1-ira.weiny@intel.com> <20201106232908.364581-5-ira.weiny@intel.com> <871rfoscz4.fsf@nanos.tec.linutronix.de> <87mtycqcjf.fsf@nanos.tec.linutronix.de> <878s9vqkrk.fsf@nanos.tec.linutronix.de> In-Reply-To: <878s9vqkrk.fsf@nanos.tec.linutronix.de> From: Dan Williams Date: Fri, 18 Dec 2020 11:20:45 -0800 Message-ID: Subject: Re: [PATCH V3 04/10] x86/pks: Preserve the PKRS MSR on context switch To: Thomas Gleixner Cc: "Weiny, Ira" , Ingo Molnar , Borislav Petkov , Andy Lutomirski , Peter Zijlstra , Dave Hansen , Fenghua Yu , X86 ML , Linux Kernel Mailing List , Andrew Morton , Linux Doc Mailing List , linux-nvdimm , Linux MM , linux-kselftest@vger.kernel.org, Greg KH Content-Type: text/plain; charset="UTF-8" X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, Dec 18, 2020 at 5:58 AM Thomas Gleixner wrote: [..] > 5) The DAX case which you made "work" with dev_access_enable() and > dev_access_disable(), i.e. with yet another lazy approach of > avoiding to change a handful of usage sites. > > The use cases are strictly context local which means the global > magic is not used at all. Why does it exist in the first place? > > Aside of that this global thing would never work at all because the > refcounting is per thread and not global. > > So that DAX use case is just a matter of: > > grant/revoke_access(DEV_PKS_KEY, READ/WRITE) > > which is effective for the current execution context and really > wants to be a distinct READ/WRITE protection and not the magic > global thing which just has on/off. All usage sites know whether > they want to read or write. I was tracking and nodding until this point. Yes, kill the global / kmap() support, but if grant/revoke_access is not integrated behind kmap_{local,atomic}() then it's not a "handful" of sites that need to be instrumented it's 100s. Are you suggesting that "relaxed" mode enforcement is a way to distribute the work of teaching driver writers that they need to incorporate explicit grant/revoke-read/write in addition to kmap? The entire reason PTE_DEVMAP exists was to allow get_user_pages() for PMEM and not require every downstream-GUP code path to specifically consider whether it was talking to PMEM or RAM pages, and certainly not whether they were reading or writing to it.