From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A1E78C433DB for ; Wed, 3 Feb 2021 16:01:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 62F2364E42 for ; Wed, 3 Feb 2021 16:01:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234731AbhBCQAp (ORCPT ); Wed, 3 Feb 2021 11:00:45 -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