Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp399483pxb; Wed, 3 Feb 2021 08:04:50 -0800 (PST) X-Google-Smtp-Source: ABdhPJz4wbFO2ZUvUtDeREeCxbDkii2lhfzEzTZcy5dPZPwiWF2JpGIaUD4V98QPM+PBa7fVWkpS X-Received: by 2002:a50:8004:: with SMTP id 4mr3606852eda.155.1612368290272; Wed, 03 Feb 2021 08:04:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612368290; cv=none; d=google.com; s=arc-20160816; b=DFHEwTx3Jv5bGDV+0Rm+MM4WIWvMZ7ZFW72Bc6Qk4Y8fRia26v/t9PEQ/vXH7mEXd9 p9PseMRWSHXz+8dksAc3Ep4qZODWEYYlEqKIldsAMCGhm0/3OC3ETY2jNeNCv5xJBZR9 M+KQFmad6wQrEarWpYf7x5mE8nquhbZsE1iHsFDPh+rL6+Qi17F2bka5+pMqkYe7Ra9a 8noznj/HtKhzwLxl4BpvLvsaubiyL23K3+/MA5l2OVezWY8/mkGPFFa/h2M4ZCbe4r3L YgerWJZGItNTyJa0OJRjjY7iU+FctmA0PHBR5OXIWj4AE0DksQWSo5a2wl1JmQWgxNSV WTqQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=2GaWvNZ9VYdmoum/C/UzD0hrK9cEZTHsK/gHDc185FA=; b=kRlJ0SfJgtahdE5vHd8iPjr6PcxT1E8exH/tEDKrlkzKTCjQpT9zCECIoSbZIRsbyW ssQtWO8cHWBeac5S2FYw10Fy5kmLiYQCYCQuzQbPjruoREbadW5+DMt1CohNnLplgLV/ uHElSVxxfvT1QSainXsHJsXTH+oLwyTvbpfl+KSaGAQxt1tM91n90dkKKorDEeC/Vuet Rph840SLcfhLxsmw6DhX5CozIl6dD56xYTG8rJQPRXU901+ATHjUJ4Hc3frUIp/k1/+e zhKeAoSK1aUgVrBVNgzyhX6SCz5LKXN6HK/SyU5IzCssvNIutofqxwexnLEPqe3e8DbD tmgg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e23si1512179edy.487.2021.02.03.08.04.24; Wed, 03 Feb 2021 08:04:50 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234758AbhBCQAl (ORCPT + 99 others); Wed, 3 Feb 2021 11:00:41 -0500 Received: from mx2.suse.de ([195.135.220.15]:46410 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233434AbhBCPys (ORCPT ); Wed, 3 Feb 2021 10:54:48 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 82534ADE5; Wed, 3 Feb 2021 15:54:06 +0000 (UTC) Date: Wed, 3 Feb 2021 16:54:08 +0100 From: Borislav Petkov To: Dave Hansen Cc: "Chang S. Bae" , Dave Hansen , x86@kernel.org, luto@kernel.org, mingo@kernel.org, tglx@linutronix.de, len.brown@intel.com, ravi.v.shankar@intel.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] x86/fpu: Use consistent test for X86_FEATURE_XSAVES Message-ID: <20210203155408.GC11823@zn.tnic> References: <20210203024052.15789-1-chang.seok.bae@intel.com> <20210203112340.GA11823@zn.tnic> <87e436d0-d2ca-8c28-442b-1b45111b6081@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87e436d0-d2ca-8c28-442b-1b45111b6081@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 03, 2021 at 07:40:07AM -0800, Dave Hansen wrote: > On 2/3/21 3:23 AM, Borislav Petkov wrote: > >> -/* > >> - * 'XSAVES' implies two different things: > >> - * 1. saving of supervisor/system state > >> - * 2. using the compacted format > >> - * > >> - * Use this function when dealing with the compacted format so > >> - * that it is obvious which aspect of 'XSAVES' is being handled > >> - * by the calling code. > > @dhansen, are you still hung up on that "obvious aspect" or can we kill > > this? > > I still want the compacted-format handling code to be marked. You can > do that with new comments: > > /* Note: XSAVES always uses compacted format: */ > if (boot_cpu_has(X86_FEATURE_XSAVES)) { > > or, leave it as-is: > > if (using_compacted_format()) { > ... > > Otherwise, we assume that every human being that looks at this code > *KNOWS* that XSAVES==compacted. That's not a great assumption. Well, the reason why I reacted to this is because I was looking at using_compacted_format() - aha this, checks X86_FEATURE_XSAVES - but then other code paths in fpu/ check X86_FEATURE_XSAVES directly. And this is confusing, making me wonder why is that special oneliner there. Sure, the comment above it says why... I guess if you wanna keep it, then we need another oneliner for 1. or really do comments at each call site. Hmm. -- Regards/Gruss, Boris. SUSE Software Solutions Germany GmbH, GF: Felix Imendörffer, HRB 36809, AG Nürnberg