Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4001364imu; Tue, 18 Dec 2018 07:35:05 -0800 (PST) X-Google-Smtp-Source: AFSGD/VF7voSFw4D7UytjjUauI7r5dt19ZAr603x6weljYDSic7DJJVhOscu3D8ShkTPdicQ1xiU X-Received: by 2002:a62:46d0:: with SMTP id o77mr17290012pfi.172.1545147305436; Tue, 18 Dec 2018 07:35:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545147305; cv=none; d=google.com; s=arc-20160816; b=xNVjMt6pH/uIIyAR6c9pf8hWL3gfK/KTP2xMstyQJ8i0Ufyv/7XkGJi36hXfRbBxd+ LZS5DDoVheSKCqxiZenZ34aGqv3witf7fTdiOjkHKgug3TWXJ8UBM1UBKf6ZSC1S4kbd qRuOldQxWrYnYR1HB+8rYv7Ht6ufzm0oT2RbsqL8OWg+GVVlUCOszYqRKM61PeTDezhu Hwb1fAOpMh/0+OLdhps5MskPdpJo/GMRfN17p8dGGf9FP73qn4H29VpxhJjD0BCGd1uW Oqd0sSWuIzbl3edoZ1HnVOIeLDXEHWywseNYPELOXkLnDhh57v2c4j6IjBsBB8+qsUp1 iWnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=qCuh1X7xnMCvOIIu9jtlbNqfqLXKX6mTTMEve5wX42Q=; b=vpsYXJqlIfBt9aw1XoXQXb1IHIWjB+rT8LwUaOf7PawIbBKyHzka7rNqFwfwp8/zR9 a84L79MBUui7+hEOEaIGbT5howpegl2UGWUEgif6j+8ZotbY7ZEYWyPhqCiAjendo9Om UXJt3eqttjkWGxnqAz2Gn518lv7oF8dVLDDL69pOIgjvI5Y/3mdoWeP8K3jUQFQIxoyz wYTTNEuC+1ZLR0SXBSq+rMKx8G1Rqzu/BwUDGoG3xyUBeNCxnw1vyK2UFoVO6qh1FIRm lQ3LF85eSUPAgxESIEvdM/tmJTv8rAL7z5VCGJq6HA2kBT+a69Ymwvd5bWrDXwtlB1jh sM7g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a17si13409905pgv.456.2018.12.18.07.34.39; Tue, 18 Dec 2018 07:35:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727008AbeLRPcx (ORCPT + 99 others); Tue, 18 Dec 2018 10:32:53 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:56411 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726690AbeLRPcw (ORCPT ); Tue, 18 Dec 2018 10:32:52 -0500 Received: from [5.158.153.52] (helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gZHMA-0004IX-VK; Tue, 18 Dec 2018 16:32:27 +0100 Date: Tue, 18 Dec 2018 16:32:26 +0100 (CET) From: Thomas Gleixner To: "Li, Aubrey" cc: Aubrey Li , mingo@redhat.com, peterz@infradead.org, hpa@zytor.com, ak@linux.intel.com, tim.c.chen@linux.intel.com, dave.hansen@intel.com, arjan@linux.intel.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 1/3] x86/fpu: track AVX-512 usage of tasks In-Reply-To: <62997df2-0817-b54d-b11e-00a567f1d67c@linux.intel.com> Message-ID: References: <20181218042218.8653-1-aubrey.li@intel.com> <62997df2-0817-b54d-b11e-00a567f1d67c@linux.intel.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 18 Dec 2018, Li, Aubrey wrote: > On 2018/12/18 22:14, Thomas Gleixner wrote: > > On Tue, 18 Dec 2018, Aubrey Li wrote: > >> diff --git a/arch/x86/include/asm/fpu/internal.h b/arch/x86/include/asm/fpu/internal.h > >> index a38bf5a1e37a..8778ac172255 100644 > >> --- a/arch/x86/include/asm/fpu/internal.h > >> +++ b/arch/x86/include/asm/fpu/internal.h > >> @@ -411,6 +411,13 @@ static inline int copy_fpregs_to_fpstate(struct fpu *fpu) > >> { > >> if (likely(use_xsave())) { > >> copy_xregs_to_kernel(&fpu->state.xsave); > >> + > >> + /* > >> + * AVX512 state is tracked here because its use is > >> + * known to slow the max clock speed of the core. > >> + */ > >> + if (fpu->state.xsave.header.xfeatures & XFEATURE_MASK_AVX512) > >> + fpu->avx512_timestamp = jiffies_64; > > > > Even if unlikely this is incorrect when running a 32 bit kernel because > > there jiffies_64 cannot be atomically loaded vs. a concurrent update. See > > the comment in include/linux/jiffies.h right above the jiffies_64 > > declaration. > > > Yeah, I noticed this, because this is under use_xsave() condition, also need > valid AVX512 state, so a 32 bit kernel won't enter this branch. What exactly prevents a 32bit kernel from having the AVX512 feature bit set? And if it cannot be set on 32bit, then why are you compiling that code in at all? Thanks, tglx