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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5CA93C433F5 for ; Fri, 26 Nov 2021 11:03:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 936426B0072; Fri, 26 Nov 2021 06:03:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8E53F6B0078; Fri, 26 Nov 2021 06:03:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7D4B46B007B; Fri, 26 Nov 2021 06:03:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0126.hostedemail.com [216.40.44.126]) by kanga.kvack.org (Postfix) with ESMTP id 6F9146B0072 for ; Fri, 26 Nov 2021 06:03:14 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 369868A9B0 for ; Fri, 26 Nov 2021 11:03:04 +0000 (UTC) X-FDA: 78850793952.19.3AB8AF6 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf11.hostedemail.com (Postfix) with ESMTP id B6FE8F000201 for ; Fri, 26 Nov 2021 11:03:03 +0000 (UTC) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1637924581; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=g4btdXn6LCRAN615sbfvmy4KHaxdnAQkd+iKSwrlwvo=; b=CirGF0lR9c+ZnkqzgiLiS/rhoR3NJVYyvCNXk6cOsd92JMu3OPQAIyDf7M6U0bYoI12qjo RIK4vELWm+OcdAOd5bAnszkMhNU+zCU8hugZCGkraktNyDlneBMWKL2FKGty74V4XShDgA qKTxV5ZGhPmFJ1fVMGIFvUG5YNJUOKpNamajvTmiOFpYKDQO/6XeoU45hwHgNtZtX/6x/J SFIzuRWWgOeDDF7sz2nxiRNeIRbIfEK/2UeNzkAOvimmuZe+6cW7YFSvfQ1UiULlgIymtc sZ2+1PgmliPJSPQhhWoLSg/UkrAY7oKSF4j8jWut3oDVel212OkvzvNVhuHTNQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1637924581; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=g4btdXn6LCRAN615sbfvmy4KHaxdnAQkd+iKSwrlwvo=; b=HHWyui7ciCWdpgjGKLwWJUFL0e52YgYQOd4ClF84HmbCDkKNguSV9k+NvMMbGI+Fx+NkLJ 3SJldidIVzzsgTDg== To: ira.weiny@intel.com, Dave Hansen , Dan Williams Cc: Ira Weiny , Peter Zijlstra , Fenghua Yu , "Hansen, Dave" , Ingo Molnar , Borislav Petkov , Andy Lutomirski , "H. Peter Anvin" , Rick Edgecombe , x86@kernel.org, linux-kernel@vger.kernel.org, nvdimm@lists.linux.dev, linux-mm@kvack.org Subject: Re: [PATCH V7 05/18] x86/pks: Add PKS setup code In-Reply-To: <87ilwgl10a.ffs@tglx> References: <20210804043231.2655537-1-ira.weiny@intel.com> <20210804043231.2655537-6-ira.weiny@intel.com> <87ilwgl10a.ffs@tglx> Date: Fri, 26 Nov 2021 12:03:01 +0100 Message-ID: <87o867gowq.ffs@tglx> MIME-Version: 1.0 Content-Type: text/plain X-Rspamd-Queue-Id: B6FE8F000201 X-Stat-Signature: 846bcnsd8ym5mee9jah65ztkrez1ms9r Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=CirGF0lR; dkim=pass header.d=linutronix.de header.s=2020e header.b=HHWyui7c; dmarc=pass (policy=none) header.from=linutronix.de; spf=pass (imf11.hostedemail.com: domain of tglx@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=tglx@linutronix.de X-Rspamd-Server: rspam02 X-HE-Tag: 1637924583-319753 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 Thu, Nov 25 2021 at 16:15, Thomas Gleixner wrote: > On Tue, Aug 03 2021 at 21:32, ira weiny wrote: > Aside of that, the function which set's up the init value is really > bogus. As you explained in the cover letter a kernel user has to: > > 1) Claim an index in the enum > 2) Add a default value to the array in that function > > Seriously? How is that any better than doing: > > #define PKS_KEY0_DEFAULT PKR_RW_ENABLE > #define PKS_KEY1_DEFAULT PKR_ACCESS_DISABLE > ... > #define PKS_KEY15_DEFAULT PKR_ACCESS_DISABLE > > and let the compiler construct pkrs_init_value? > > TBH, it's not and this function has to be ripped out in case that you > need a dynamic allocation of keys some day. So what is this buying us > aside of horrible to read and utterly pointless code? And as Taoyi confirmed its broken. It surely takes a reviewer to spot that and an external engineer to run rdmsr -a to validate that this is not working as expected, right? Sigh...