Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2510pxb; Mon, 31 Jan 2022 03:48:54 -0800 (PST) X-Google-Smtp-Source: ABdhPJzw4l3432HU8lZ2tBqrfEF9XxaqUm3QkZRKQgvjgcH91KCEG+CJa1MRgbMb/is3DvgTxjM3 X-Received: by 2002:a17:90a:9a7:: with SMTP id 36mr33802768pjo.154.1643629734020; Mon, 31 Jan 2022 03:48:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643629734; cv=none; d=google.com; s=arc-20160816; b=BC2qAaXATGouCyV72izSNTvM2rneXqcvxLDt/nIRTks20t6ALm1/jfvs7BHmGWoqWc O8bQcIwn8N/t42ZRZn5R8kCztZUQpKeQ5A5XnbQx5z+9o4eRYZe6ZxmHfHBtsNQneRWU TqHBZyDDjFoKRPDm8wqQiooaEjSXwChBiSCfR0L0d+Af5ynaCl58zD7oE7yy0nVUne4X sk8aqoGIUY4pff/37lbvxD80+idd9dhU0NOofrbTxYED2VF3NdP0Z+ge0zDubkx5GbVr /QNcHtUiJpAVIbsc56VtVnTYqFNrxlvsAHr228fO/sSDgZiNO0gFvHL5/zxJRXpt8ZCm Mgww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=iWn3Bf2q+El573dnS5D05+y+NJ+ltDCvJbKncotvEFU=; b=aJlFk7iptTHzwfpEHUPBQq6QiHxXr4xJ1S/IFisaLBjzemOL3ZSK6Vdyo63Woz0fPk YWz5k/gwET+Ukg47GKN+s+nF19ruSJXY0guYHVkwijUgxjE75LU8CP4gUtuR8I2LTjRS bvKaFvfkB+PXdvXQSMe3ytlAuP5uDDoKsJeq1LDo6crqC2LETZ0E/gzrQNpUCrdzI8IW LXzzJGbgAtEk//YHnkcVH6YfH/UwTt61bPE9xQvRZImrrLFDbij5HU4lQM9VT/XTjThG AqQ+XIe202sqiTtZ00GxUvLJlXIrrmIP/m/qUQrw4jxv643FSsO/LF2IMxemccusoAW1 QsDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=m4QB9awQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e8si13554811pgc.243.2022.01.31.03.48.43; Mon, 31 Jan 2022 03:48:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=m4QB9awQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1348900AbiA1XKT (ORCPT + 99 others); Fri, 28 Jan 2022 18:10:19 -0500 Received: from mga17.intel.com ([192.55.52.151]:45590 "EHLO mga17.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344400AbiA1XKQ (ORCPT ); Fri, 28 Jan 2022 18:10:16 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643411416; x=1674947416; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=jOrlcko0k1147pqRHZRt0p4VwCWQTKMZanWLQynKTUs=; b=m4QB9awQDqUvVL41UANlDGUOQAixOkEpsuN2VsK4LsOaBLHRL1+wqdfU v2mJnCO4wwNS1Onj0kAynZVb6BNyFqe00MYwHTJbWpv4dEf2SO9zc7eQJ Np4ZV3UG0DPJ7pS/1wzDlkDH5ByDFSknRGNPBRMrB+hwYIBZ5YaLRFsPX 598gjpaW3l/fNOUuZ8nQqltcPCFjRn7xsOjKMInfe+Ox24XvWxRYQBet5 nTBGblL2hJ9sEZ1wwn2lg5mINYrRovvi1QL/leWUvtXVGY9yF6nGvKGyf DXOv5AeKPQdp+9RBJqWW4QBRRy8sLY5Z46CRkyqm9cGCTPQWQes3RTQWF A==; X-IronPort-AV: E=McAfee;i="6200,9189,10241"; a="227882608" X-IronPort-AV: E=Sophos;i="5.88,325,1635231600"; d="scan'208";a="227882608" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jan 2022 15:10:16 -0800 X-IronPort-AV: E=Sophos;i="5.88,325,1635231600"; d="scan'208";a="536325572" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.147]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Jan 2022 15:10:16 -0800 Date: Fri, 28 Jan 2022 15:10:16 -0800 From: Ira Weiny To: Dave Hansen Cc: Dave Hansen , "H. Peter Anvin" , Dan Williams , Fenghua Yu , Rick Edgecombe , linux-kernel@vger.kernel.org Subject: Re: [PATCH V8 06/44] mm/pkeys: Add Kconfig options for PKS Message-ID: <20220128231015.GK785175@iweiny-DESK2.sc.intel.com> References: <20220127175505.851391-1-ira.weiny@intel.com> <20220127175505.851391-7-ira.weiny@intel.com> <9c4a8275-236d-67b6-07f9-5e46f66396c0@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9c4a8275-236d-67b6-07f9-5e46f66396c0@intel.com> User-Agent: Mutt/1.11.1 (2018-12-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 28, 2022 at 02:54:26PM -0800, Dave Hansen wrote: > On 1/27/22 09:54, ira.weiny@intel.com wrote: > > From: Ira Weiny > > > > Protection Key Supervisor, PKS, is a feature used by kernel code only. > > As such if no kernel users are configured the PKS code is unnecessary > > overhead. Indeed this was a bit weak sorry. See below. > > > > Define a Kconfig structure which allows kernel code to detect PKS > > support by an architecture and then subsequently enable that support > > within the architecture. > > > > ARCH_HAS_SUPERVISOR_PKEYS indicates to kernel consumers that an > > architecture supports pkeys. PKS users can then select > > ARCH_ENABLE_SUPERVISOR_PKEYS to turn on the support within the > > architecture. > > > > If ARCH_ENABLE_SUPERVISOR_PKEYS is not selected architectures avoid the > > PKS overhead. > > > > ARCH_ENABLE_SUPERVISOR_PKEYS remains off until the first kernel use case > > sets it. > > This is heavy on the "what" and weak on the "why". > > Why isn't this an x86-specific Kconfig? Why do we need two Kconfigs? > Good old user pkeys only has one: > > config ARCH_HAS_PKEYS > bool > > and it's in arch-generic code because there are ppc and x86 > implementations *and* the pkey support touches generic code. > > This might become evident later in the series, but it's clear as mud as > it stands. Sorry, I'll expand on this. This issue is that because PKS users are in kernel only and are not part of the architecture specific code there needs to be 2 mechanisms within the Kconfig structure. One to communicate an architectures support PKS such that the user who needs it can depend on that config as well as a second to allow that user to communicate back to the architecture to enable PKS. Ira