Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp828082ybz; Wed, 29 Apr 2020 10:05:53 -0700 (PDT) X-Google-Smtp-Source: APiQypLEBY5s8Ox3VbBLrLyNgmONXtIpjAd2ZDpSDOTBLlOUODfWmNSkTACMrbL1qgfja4keZJh7 X-Received: by 2002:a17:906:edb5:: with SMTP id sa21mr3674606ejb.270.1588179953061; Wed, 29 Apr 2020 10:05:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588179953; cv=none; d=google.com; s=arc-20160816; b=sA36Z9vnNsdhZG/Xv5IpKhMIaX9M76qnVFWKPTb8zQtLAzpaSvUnAWbXPd7vnzS4lv tbqzBq2LngttGqZOkPkIWAXmdL8Hkh3lmbIhaeMRn2yiw5Fp9zl+QPIvw2rgPINMopLo ame77vbs11m7ZFKugrbP7Nl6D9yMd6TxwTOl2ggdoSvjhIQd3eNYMV1mjIy2DrdTnllD LwDDgBfxWNT8g6tg7nHuGsdEZAzpZ/gQvapQIo912qWWXt1ByOQpkW1+JKP7iHi7T3gQ t3XIHc+hpMvzfcai/9dph695lwzH6HiMj7SqSU0kd60bGUy43zbpKVof7vWzgzWmb4j5 d5xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:date:cc:to:from:subject :message-id:ironport-sdr:ironport-sdr; bh=dtsS8j8lAkN4WHKyskpLjeJY11N/fpAA5x/ytMYP7EQ=; b=B75Ygho5PwzpVL868WASpwrKNM3q4aCyjxDjJ7TxPX2w7lg3ZQHaHAOuiBStRnXQB8 JNFW+LCLh/0iLj1cQsgTF/WuzXy1LvPGTHNpclGzKSOWw3uhVYA7zy+VYt+jtJE4ANfr dJvkmiaq6YRirwK3eeTgv1yArOlI7QWBMtpyKppIHKeWRuFD6S9+dtXR+wKYnN5N1ggL 2PXen7qVT5GxYmpkk0Eamo3vBeSrvF8mBWPYNJTzVkH5LUa+aNl/gi9GelJ3WR9cTd9J QfnRWzn9tc7pkwQm/01SVjtz0M4mf+yA6O4IOLfVifSD9fh+lDgaFoFO5JhUgceSoeyb 3sQA== 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 o22si4280481ejh.233.2020.04.29.10.05.25; Wed, 29 Apr 2020 10:05:53 -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 S1727865AbgD2RCt (ORCPT + 99 others); Wed, 29 Apr 2020 13:02:49 -0400 Received: from mga14.intel.com ([192.55.52.115]:16013 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726530AbgD2RCt (ORCPT ); Wed, 29 Apr 2020 13:02:49 -0400 IronPort-SDR: OnVH5QCIA1TEd9TRkzGzUxpzSAA+w4znlZO3msVnx6qTQiM9eqkmdK/wcAMUyJKYDJ2nJd8SXU CMhIEI/FYpXg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2020 10:02:45 -0700 IronPort-SDR: mQULBHZb41yIVnbCt9y5lfq/YPmOopAi1d86ySjeS9k08T2lUaNk7f+0PmCj6GMa7h3CkMF6HB +IfCa2rYO9UA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,332,1583222400"; d="scan'208";a="258020657" Received: from yyu32-desk.sc.intel.com ([143.183.136.146]) by orsmga003.jf.intel.com with ESMTP; 29 Apr 2020 10:02:44 -0700 Message-ID: <1b43e3cc36dd707c0268e96b166eca4421d7c2e2.camel@intel.com> Subject: Re: [PATCH v3 05/10] x86/fpu/xstate: Define new functions for clearing fpregs and xstates From: Yu-cheng Yu To: Borislav Petkov Cc: linux-kernel@vger.kernel.org, x86@kernel.org, "H. Peter Anvin" , Thomas Gleixner , Ingo Molnar , Dave Hansen , Tony Luck , Andy Lutomirski , Rik van Riel , "Ravi V. Shankar" , Sebastian Andrzej Siewior , Fenghua Yu , Peter Zijlstra Date: Wed, 29 Apr 2020 10:02:46 -0700 In-Reply-To: <20200429163906.GC16407@zn.tnic> References: <20200328164307.17497-6-yu-cheng.yu@intel.com> <20200429160644.28584-1-yu-cheng.yu@intel.com> <20200429163906.GC16407@zn.tnic> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.4 (3.32.4-1.fc30) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2020-04-29 at 18:39 +0200, Borislav Petkov wrote: > On Wed, Apr 29, 2020 at 09:06:44AM -0700, Yu-cheng Yu wrote: > > From: Fenghua Yu > > > > Currently, fpu__clear() clears all fpregs and xstates. Once XSAVES > > supervisor states are introduced, supervisor settings (e.g. CET xstates) > > must remain active for signals; It is necessary to have separate functions: > > > > - Create fpu__clear_user_states(): clear only user settings for signals; > > - Create fpu__clear_all(): clear both user and supervisor settings in > > flush_thread(). > > > > Also modify copy_init_fpstate_to_fpregs() to take a mask from above two > > functions. > > > > Signed-off-by: Fenghua Yu > > Co-developed-by: Yu-cheng Yu > > Signed-off-by: Yu-cheng Yu > > Reviewed-by: Dave Hansen > > Reviewed-by: Tony Luck > > > > v3: > > - Put common code into a static function fpu__clear(), with a parameter > > user_only. > > > > v2: > > - Fixed an issue where fpu__clear_user_states() drops supervisor xstates. > > - Revise commit log. > > Try applying that patch from this mail yourself and see whether the > patch changelog will remain in the commit message or it will get > discarded. My mistake! I will fix it. > > > @@ -318,18 +313,40 @@ static inline void copy_init_fpstate_to_fpregs(void) > > * Called by sys_execve(), by the signal handler code and by various > > * error paths. > > */ > > -void fpu__clear(struct fpu *fpu) > > +static void fpu__clear(struct fpu *fpu, int user_only) > > { > > - WARN_ON_FPU(fpu != ¤t->thread.fpu); /* Almost certainly an anomaly */ > > + WARN_ON_FPU(fpu != ¤t->thread.fpu); > > Why did you remove the side comment? > > Is it wrong? > > Why do you do such arbitrary changes which are not needed instead of > concentrating on only the changes the patch should do? It has been some time since Thomas commented on this tail comment. https://lore.kernel.org/lkml/alpine.DEB.2.21.1908161703010.1923@nanos.tec.linutronix.de/ I think why not fixing it while at it. Yu-cheng