Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp196520pxm; Tue, 1 Mar 2022 18:25:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJyGvEbJIAp9sNwSlWGtVI/BgFLdLsHlG5ucBWd6RYY3F7XwUULfh3dfuwc+h1T7XsI8XKpk X-Received: by 2002:a17:906:314b:b0:6d6:da31:e545 with SMTP id e11-20020a170906314b00b006d6da31e545mr7145075eje.125.1646187936858; Tue, 01 Mar 2022 18:25:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646187936; cv=none; d=google.com; s=arc-20160816; b=PalpQoW0jAWo70J5PVwk5o9sRjI8wubiKkUk8Sl7sJB4us0U8qdCjhdHnd7C3nh/cQ qWfPuXbcheKo//pzVnHXTZ7fOTmas2OQ/0nOpr3Rl9WO5jyWK9KfytP0fDnUvC85yArW SEf6x8BJciReyX14dN5cUtFo2vsmlIaD0b4bJ04aSM65RrGxsvBrj7+oNE0aAeDEA2pR AlGY6DAv3vGbEF5zIYlJNS76kop/+VRgkOjcHId3KMIilWozTwi8uiWIOpSAUMwF5lGS 5eao9j5Haz9ZBVuwCqlf/uT+DcRiEsOH33N7UepLRXRNfokwxCqtAC0Fi285HTQjbU/h Rrug== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=iPrEtA+CppGTtNyVI+Olnyc+oq69fKXsI4VtltoM8fs=; b=A1uZa/HLLEfx1XOX3CBgjjy0JOu+SSe+sGwczNz3NzQ1XC4YRl8Ey3a8s8KNEoVqDe H8ZLvW4e14qmo1fJB64I3x6ki69dRx9+bjsaO+J96CQ4qNp1DfuscJV/msSpYeSgzdt3 IWI7/E7z93tCzC2l8FizcoWSsB1KuS9ZQaNjYfVzXQja/yLRHq7jl5PaSdkDUM+TMQX4 B8tr20IvS1fENsbAl5zZGh1cMfzoZOJECwyl7U45WhriZO7B8jwrGV48MoeYD6Q+WQuq OyOMuuEriA+B8TZV6qZtR+pJyYK+kr6dqVjDdDCCJu/I6c267cAhvozZCjZ1IRQXYk2C bFQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=igJDhxDQ; 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=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n18-20020aa7d052000000b00410cc13a462si9678088edo.328.2022.03.01.18.25.12; Tue, 01 Mar 2022 18:25:36 -0800 (PST) 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=@intel.com header.s=Intel header.b=igJDhxDQ; 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=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235923AbiCAP5Z (ORCPT + 99 others); Tue, 1 Mar 2022 10:57:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48826 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235865AbiCAP5R (ORCPT ); Tue, 1 Mar 2022 10:57:17 -0500 Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8D9776620C for ; Tue, 1 Mar 2022 07:56:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1646150196; x=1677686196; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=wkVALN3/qIQqFwnPf+wRUxVnXrAa2lYmcDvBiJAO14c=; b=igJDhxDQqAzK3qptF/0dY1Hu1R61bGSPKOFYGb9VGDe1WQkKRrvZ/3gj j7VDd/vbGSev4ZJ4PsSBiaNMRmHYtmOVxphmOhhjQcIjICcreRFTP9k72 IVfO9/vc+rMaPWIU3DXuOMQ0uRjpiINYLOkwzt48Cu7PaROVVZsHxGmVY fVXjN/tpqZimWt4dK/9AkEB/QVeLrD/9EYzXOhfpYNop/Wp/1RuRiMuUI feRbsWf1ztxSxJ1/40Iy1+cycOBchmfwA1aambuwAwbeN0QgLVtSsiNnb GmrOux8xPXli8Fk3vi5VZBral8vwkxp43TuFkXgW57bgWbKiXKN6efP6R Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10272"; a="251989783" X-IronPort-AV: E=Sophos;i="5.90,146,1643702400"; d="scan'208";a="251989783" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2022 07:56:36 -0800 X-IronPort-AV: E=Sophos;i="5.90,146,1643702400"; d="scan'208";a="778493375" Received: from bklinvil-mobl.amr.corp.intel.com (HELO localhost) ([10.212.48.220]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2022 07:56:31 -0800 Date: Tue, 1 Mar 2022 07:56:30 -0800 From: Ira Weiny To: Dan Williams Cc: Dave Hansen , "H. Peter Anvin" , Fenghua Yu , Rick Edgecombe , Linux Kernel Mailing List Subject: Re: [PATCH V8 33/44] memremap_pages: Introduce pgmap_protection_available() Message-ID: References: <20220127175505.851391-1-ira.weiny@intel.com> <20220127175505.851391-34-ira.weiny@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE,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 On Mon, Feb 28, 2022 at 08:59:44AM -0800, Ira Weiny wrote: > On Fri, Feb 04, 2022 at 08:19:43AM -0800, Dan Williams wrote: > > On Thu, Jan 27, 2022 at 9:55 AM wrote: > > [snip] > > > > @@ -63,6 +64,16 @@ static void devmap_managed_enable_put(struct dev_pagemap *pgmap) > > > } > > > #endif /* CONFIG_DEV_PAGEMAP_OPS */ > > > > > > +#ifdef CONFIG_DEVMAP_ACCESS_PROTECTION > > > + > > > +bool pgmap_protection_available(void) > > > +{ > > > + return pks_available(); > > > +} > > > +EXPORT_SYMBOL_GPL(pgmap_protection_available); > > > > Any reason this was chosen to be an out-of-line function? Doesn't this > > defeat the performance advantages of static_cpu_has()? > > Unfortunately, yes. pkeys.h includes mm.h which means I can't include pkeys.h > here in mm.h. > > Let me see what I can do. In patch 11 I created pks-keys.h. Let me see if I > can leverage that header instead of pkeys.h. > > When I created that header I was thinking that the user and supervisor pkey > functions may need even more separation in the headers but I was fearful of > putting too much in pks-keys.h because it was created to avoid conflicts in > asm/processor.h. Looking at it again I think pks_available() may be ok in > pks-keys.h. Ok I've reworked the series to allow for this. However, pks-keys.h was not sufficient. That header needs to be specific to the definition of the keys themselves (hence the name). In order to facilitate this change I've introduced another header linux/pks.h which separates out the supervisor specific calls from the user pkeys calls. It worked out well and I think makes a lot of sense due to the different functionality. But I'm pretty bad at names so I'm open to changing the name of the header if 'pks.h' seems too generic. Ira > > Ira > > > > > > + > > > +#endif /* CONFIG_DEVMAP_ACCESS_PROTECTION */ > > > + > > > static void pgmap_array_delete(struct range *range) > > > { > > > xa_store_range(&pgmap_array, PHYS_PFN(range->start), PHYS_PFN(range->end), > > > -- > > > 2.31.1 > > >