Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1002950pxj; Thu, 27 May 2021 17:33:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyQCyHaH934V+kP+V4Zd39tuLbSTHDwES8mnO2L0tFiU7D8HtlHw5xl2iODskUIb2ejkp2F X-Received: by 2002:a05:6402:138c:: with SMTP id b12mr7107667edv.268.1622162015827; Thu, 27 May 2021 17:33:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622162015; cv=none; d=google.com; s=arc-20160816; b=zPB6HdXKpYvjXagzvfIrOLMQiB2CHj7uN8crPWbHEOKBsO6Zoaq5iiWMbf6jC5B9a/ 7CC8RiUhFS+JV0yrPISrXWNI2EFV1pCpBWOnzvgAXzPZvuZy9DP555hWB/wOPoJwbD9u zWn5amgBK5Y+hvY/k0LIv2J74+5c+LAeFIPvkqrlhRrOv+X+zidPIymOjv18mnjdsun8 4+US9T5/HwQZf6ixXRVcdOEpU9qTPDoOh4J1QHf+ZRIbxUyZ9feGQSGRT+UFqXb4u/tX OPVPsXilOPhBU43PcXdHwfyBEpvVc218FBj2bL4iuPdxinSCvnF2CAkb9PTO6q3aHNJW uLrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:in-reply-to:references:date:from:cc :to:subject:ironport-sdr:ironport-sdr; bh=jGSYHqqbuC/4xBMZIba0s+OPBgixXIBNKgrOn2T2mbQ=; b=CdY5kvFqoYHgDVLpJeWGkOtiqk/FYl+kAZ60ZiHO6BakXVaZMm9V6Wd2JbexJq81ht fjUclPyQmKj7H2y6vod1FxXJwtUCgxbFDrBFQgDmE96MHjadIdlp3RAR0f0704j2dloG O5pp51o7PlgUah43sutxMk7To4PLKwg3djK998An9lCnMI4hhn+HVZpwD4ieux/cWOcY zHQFD8th+Vaf8+UZUVb0tysnOmExPcBn9GIPRF0hobeaON4obAMqUJISVs80Dc496ohM Xop/EWMFAAQsggZxzex2iqX40FLInT2+7IpRexiQUhIvN7KUTgrJhn+9LoxWJvZL6T1b u6cQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 p26si3150923edy.402.2021.05.27.17.33.12; Thu, 27 May 2021 17:33:35 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234278AbhE0X7g (ORCPT + 99 others); Thu, 27 May 2021 19:59:36 -0400 Received: from mga18.intel.com ([134.134.136.126]:10241 "EHLO mga18.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236203AbhE0X7K (ORCPT ); Thu, 27 May 2021 19:59:10 -0400 IronPort-SDR: 2tK2K3W07ILJL2kx6QxKhz5g4gnSdNWpUCqj0vR6S1HwDOBMe9LkTOLh1C81BZGCLZiX8fauEx cRcd/kEKA4gw== X-IronPort-AV: E=McAfee;i="6200,9189,9997"; a="190229892" X-IronPort-AV: E=Sophos;i="5.83,228,1616482800"; d="scan'208";a="190229892" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 May 2021 16:57:36 -0700 IronPort-SDR: ZeIFmsdsFsOlue/8YEFXyR6NydiZCn/WmQ1NjqfrLjrWgFb8OJC/EeEGhPimHBbp8ROR/GbO2m 9PPKTfr6G0RQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,228,1616482800"; d="scan'208";a="472807339" Received: from viggo.jf.intel.com (HELO localhost.localdomain) ([10.54.77.144]) by FMSMGA003.fm.intel.com with ESMTP; 27 May 2021 16:57:35 -0700 Subject: [PATCH 2/5] x86/pkeys: rename write_pkru() To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, Dave Hansen , tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, x86@kernel.org, luto@kernel.org, shuah@kernel.org, babu.moger@amd.com, dave.kleikamp@oracle.com, linuxram@us.ibm.com, bauerman@linux.ibm.com, bigeasy@linutronix.de From: Dave Hansen Date: Thu, 27 May 2021 16:51:13 -0700 References: <20210527235109.B2A9F45F@viggo.jf.intel.com> In-Reply-To: <20210527235109.B2A9F45F@viggo.jf.intel.com> Message-Id: <20210527235113.C5DAFE12@viggo.jf.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Hansen write_pkru() was once concerned purely with writing to the PKRU register. However, the current task XSAVE buffer must also be updated in a coordinated way. Change the naming to reflect that this is an operation which applies to a task (current) and its state in addition to the register itself. Signed-off-by: Dave Hansen Cc: Thomas Gleixner Cc: Ingo Molnar Cc: Borislav Petkov Cc: x86@kernel.org Cc: Andy Lutomirski Cc: Shuah Khan Cc: Babu Moger Cc: Dave Kleikamp Cc: Ram Pai Cc: Thiago Jung Bauermann Cc: Sebastian Andrzej Siewior --- b/arch/x86/include/asm/fpu/xstate.h | 6 +++++- b/arch/x86/kernel/fpu/xstate.c | 2 +- b/arch/x86/mm/pkeys.c | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff -puN arch/x86/include/asm/fpu/xstate.h~rename-write_pkru arch/x86/include/asm/fpu/xstate.h --- a/arch/x86/include/asm/fpu/xstate.h~rename-write_pkru 2021-05-27 16:40:24.618705468 -0700 +++ b/arch/x86/include/asm/fpu/xstate.h 2021-05-27 16:40:24.631705468 -0700 @@ -124,7 +124,11 @@ static inline u32 read_pkru(void) return 0; } -static inline void write_pkru(u32 pkru) +/* + * Update all of the PKRU state for the current task: + * PKRU register and PKRU xstate. + */ +static inline void current_write_pkru(u32 pkru) { struct pkru_state *pk; diff -puN arch/x86/kernel/fpu/xstate.c~rename-write_pkru arch/x86/kernel/fpu/xstate.c --- a/arch/x86/kernel/fpu/xstate.c~rename-write_pkru 2021-05-27 16:40:24.620705468 -0700 +++ b/arch/x86/kernel/fpu/xstate.c 2021-05-27 16:40:24.633705468 -0700 @@ -1026,7 +1026,7 @@ int arch_set_user_pkey_access(struct tas old_pkru &= ~((PKRU_AD_BIT|PKRU_WD_BIT) << pkey_shift); /* Write old part along with new part: */ - write_pkru(old_pkru | new_pkru_bits); + current_write_pkru(old_pkru | new_pkru_bits); return 0; } diff -puN arch/x86/mm/pkeys.c~rename-write_pkru arch/x86/mm/pkeys.c --- a/arch/x86/mm/pkeys.c~rename-write_pkru 2021-05-27 16:40:24.626705468 -0700 +++ b/arch/x86/mm/pkeys.c 2021-05-27 16:40:24.634705468 -0700 @@ -139,7 +139,7 @@ void copy_init_pkru_to_fpregs(void) * Override the PKRU state that came from 'init_fpstate' * with the baseline from the process. */ - write_pkru(init_pkru_value_snapshot); + current_write_pkru(init_pkru_value_snapshot); } static ssize_t init_pkru_read_file(struct file *file, char __user *user_buf, _