Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp777395ybz; Wed, 29 Apr 2020 09:12:04 -0700 (PDT) X-Google-Smtp-Source: APiQypLBBV1VYIfNjTTRSRdPXLFek7vEuYyMDqoSdIstVS00XhCNrTXXWDWWmlq4G6vvfizBr/LL X-Received: by 2002:a17:906:1804:: with SMTP id v4mr3460682eje.104.1588176723773; Wed, 29 Apr 2020 09:12:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588176723; cv=none; d=google.com; s=arc-20160816; b=Kf2iV4r1tiE8vx9uLD0JtjEFXbSsgD3aFFSJ6hzdsapxxDNjcnvNhmz0VbtFJM0xPk sf8yau0ImMglhzrziUJgLxeSirY779oMXJLVcAtU9sS96WJyAdJ0pAYpvnmgiE2Cyo4b LqpAG2wQRZ+IV5+o3XRcF/cI1JFHF3EfXyEZAsjciCYLNJgsSiy1KXt71GkKyXUQjd0C C9TAs2Iq1KEDJpNfaEK6Bf4Y1CUpcYzna4mJy6RtptMHeVE4OTUV+I+ofYpr83D+zGqv NUYeYng0GtGbh+S6bUJXNAmlj38ctWwWlDFnmkjllzxCvu1TfoX2lxegKQa1Y+Bq4wCQ bMGQ== 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=HFDj4vjiA1AKZIZ4oPgKWjOQ8wWfPWyMiUBMtv3q1jc=; b=jotibtbWdXwfCUgSsqsklc1WLaR/2uo7HpAtMIL18cHwGZaDrXL5tqTuE9XK8laWU1 Pv095/hSkaChnfG1fMVCVpl1w3zcZpSoEJJJ8ESZ+VH2if7pcWapUI0h88/6o/z/0paI 5d3wzoMM5o+KQTURY/e0sahZbEIFMLtcuWDEM7kekyS3jN2bsqTOd7R+oENXrTJtfFX6 Xktf9/8GZ4KfiLkhi1fsnoVHScbDJeHQLtZsI8V/i0H/lvTqvHciZIQ+oBV7IVH31OF9 urDpXzE0awZjTe44g6QkY4xwJ3MKfq98uHOf3UNsZMxbjtJqFm767MRHpxBHRCeisnOo BIgQ== 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 h23si4095820ejq.206.2020.04.29.09.11.36; Wed, 29 Apr 2020 09:12:03 -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 S1727030AbgD2QJM (ORCPT + 99 others); Wed, 29 Apr 2020 12:09:12 -0400 Received: from mga01.intel.com ([192.55.52.88]:49801 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726539AbgD2QJL (ORCPT ); Wed, 29 Apr 2020 12:09:11 -0400 IronPort-SDR: EKCP6PpRHvDwAO9R9pRS/mqdnRdvDzYchr+U8CPiXsTXrHMkIRk1hGv1baP20o7WbivKsKi/0y dzbQNEQQWBOw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Apr 2020 09:09:11 -0700 IronPort-SDR: o13zNz1X0zp6nQ4m3uOuK7eeFIPIHlOfwZSrqqI9JIJomJmMZ3m5cm5P8+cYRCH5n77jWhckeA bAounM1t1bOA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,332,1583222400"; d="scan'208";a="249494398" Received: from yyu32-desk.sc.intel.com ([143.183.136.146]) by fmsmga008.fm.intel.com with ESMTP; 29 Apr 2020 09:09:11 -0700 Message-ID: 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 09:09:12 -0700 In-Reply-To: <20200429092735.GA16407@zn.tnic> References: <20200328164307.17497-1-yu-cheng.yu@intel.com> <20200328164307.17497-6-yu-cheng.yu@intel.com> <20200429092735.GA16407@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 11:27 +0200, Borislav Petkov wrote: > On Sat, Mar 28, 2020 at 09:43:02AM -0700, Yu-cheng Yu wrote: > > @@ -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 clear_user_only) > > I said: > > "fpu__clear(struct fpu *fpu, bool user_only)" > ^^^^^^^^^^^^^^ > > you made it > > ..., int clear_user_only) > > Why? > > If you agree with the review comment, then please do it as suggested. If > you don't, then say why you don't. > > Why would you do something in-between? > > > { > > - WARN_ON_FPU(fpu != ¤t->thread.fpu); /* Almost certainly an anomaly */ > > Why are you moving this into the callers when *both* do it? > > > + if (static_cpu_has(X86_FEATURE_FPU)) { > > Flip this logic: > > if (!static_cpu_has(X86_FEATURE_FPU)) { > fpu__drop(fpu); > fpu__initialize(fpu); > return; > } > > fpregs_lock(); > ... > > to save an indentation level and make the important case more readable > and locking more prominent. All fixed. Thanks, Yu-cheng