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=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 5B817C432BE for ; Thu, 12 Aug 2021 17:09:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 40C2060FD7 for ; Thu, 12 Aug 2021 17:09:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235208AbhHLRJb (ORCPT ); Thu, 12 Aug 2021 13:09:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235126AbhHLRJU (ORCPT ); Thu, 12 Aug 2021 13:09:20 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3652C061756; Thu, 12 Aug 2021 10:08:54 -0700 (PDT) Received: from zn.tnic (p200300ec2f0f8300207fa77f9285c0b6.dip0.t-ipconnect.de [IPv6:2003:ec:2f0f:8300:207f:a77f:9285:c0b6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 56FA21EC04FB; Thu, 12 Aug 2021 19:08:49 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1628788129; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:in-reply-to:in-reply-to: references:references; bh=V/K6iCeE0MoLZTtP5W4vJ+sANgh83kvWLuTqE8TAOjY=; b=TxI0FczNkTrobUxyNi31De7NeNnHXcA/OxKDy4SzpvAUR4q6cJdbt4sqiueXMvti7Z3uDc e2fFGhelJhkznEs9cDg97rSkOeK4T3OxOGK7nO4g88MHMA7JRWYckpiS9mMF3CIK5elgEE 8+G2AwFPfbXeQfE0TtLhgx+eO5tlUkY= Date: Thu, 12 Aug 2021 19:09:28 +0200 From: Borislav Petkov To: "Chang S. Bae" Cc: luto@kernel.org, tglx@linutronix.de, mingo@kernel.org, x86@kernel.org, len.brown@intel.com, dave.hansen@intel.com, thiago.macieira@intel.com, jing2.liu@intel.com, ravi.v.shankar@intel.com, linux-kernel@vger.kernel.org, kvm@vger.kernel.org Subject: Re: [PATCH v9 07/26] x86/fpu/xstate: Convert the struct fpu 'state' field to a pointer Message-ID: References: <20210730145957.7927-1-chang.seok.bae@intel.com> <20210730145957.7927-8-chang.seok.bae@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20210730145957.7927-8-chang.seok.bae@intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 30, 2021 at 07:59:38AM -0700, Chang S. Bae wrote: > diff --git a/arch/x86/include/asm/fpu/types.h b/arch/x86/include/asm/fpu/types.h > index f5a38a5f3ae1..c7826708f27f 100644 > --- a/arch/x86/include/asm/fpu/types.h > +++ b/arch/x86/include/asm/fpu/types.h > @@ -339,13 +339,30 @@ struct fpu { > /* > * @state: > * > - * In-memory copy of all FPU registers that we save/restore > - * over context switches. If the task is using the FPU then > - * the registers in the FPU are more recent than this state > - * copy. If the task context-switches away then they get > - * saved here and represent the FPU state. > + * A pointer to indicate the in-memory copy of all FPU registers > + * that are saved/restored over context switches. > + * > + * Initially @state points to @__default_state. When dynamic states > + * get used, a memory is allocated for the larger state copy and > + * @state is updated to point to it. Then, the state in ->state > + * supersedes and invalidates the state in @__default_state. > + * > + * In general, if the task is using the FPU then the registers in > + * the FPU are more recent than the state copy. If the task > + * context-switches away then they get saved in ->state and > + * represent the FPU state. > + */ > + union fpregs_state *state; > + > + /* > + * @__default_state: > + * > + * Initial in-memory copy of all FPU registers that saved/restored > + * over context switches. When the task is switched to dynamic > + * states, this copy is replaced with the new in-memory copy in > + * ->state. > */ > - union fpregs_state state; > + union fpregs_state __default_state; > /* > * WARNING: 'state' is dynamically-sized. Do not put ^^^^^^ that needs to be __default_state as it is which is dynamically-sized. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette