[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 4/5] x86: Read MSR_ARCH_CAPS immediately after early_microcode_init()


  • To: Alejandro Vallejo <alejandro.vallejo@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 19 Jun 2023 17:57:14 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=9A/PKVULEm1DS5aR7DiEHFj4m/K2MiLPWgyED5JqJP0=; b=NQ7y2zh6dTveDqhfJlGMYI4rDQXsbcglGHG3XE0HGHh6jFyJydmiN8WOCmz6f1jRCTnT+9lAjifDDRlEiJ0waA55N+945950co01rg8mNwRKn0bL8P+drf4T8K4hF+amrWeAnALR1ZeKXJJBt7Bu47wr/oKYm5xNUqVgeVaCdVVsgYtmaJMzjzzV0FgFb2bn/a4utfU98cI9auZEz1Mc3jwEmI5ADER7XJXGACjubOy5w8t2VnIAdTemrKnQRuG1mIPyT7eZEzp2bo0qo/jilHiZua5vP+sjKYnNjzibbtNOfD1kWdwMZagEuUINUvFGAWq3LptzcDPayHJEMek+pw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HQ8kirtkpkRffypcitRX468fdXyJR61S4IsH03H686UUG1nHndvL54+CScOGa8XsweBvyEwF1RwRYkav31TIsB/z1QDfT6vD9VyIRcUYYmx9dL7SvMpmba+YDmRN4E/O8IW3yYXo6cA9qh9U5BT7Wmxufcp6bvAqf4YF4YvVY/yyfaNO5dwJaveP+jQCu7SNounQZzlSe99anw9qBOeZy9GWbCa6bQu2128JvuObsc9v/sd0OBwhQW+oysgtHjodEdr9bW0BV+abjYv6KcUN85IVitt9niyU5DEUXL8VWtsXMZH8AAiSK5KZMTtv2kJiD2h9YtyRc9TsiEvPZGHTLw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Mon, 19 Jun 2023 15:57:29 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 15.06.2023 17:48, Alejandro Vallejo wrote:
> --- a/xen/arch/x86/cpu/microcode/core.c
> +++ b/xen/arch/x86/cpu/microcode/core.c
> @@ -879,5 +879,18 @@ int __init early_microcode_init(unsigned long 
> *module_map,
>      if ( ucode_mod.mod_end || ucode_blob.size )
>          rc = early_microcode_update_cpu();
>  
> +    /*
> +     * We might have exposed MSR_ARCH_CAPS after the microcode update.

I'm struggling a little with this sentence, but not being a native speaker
it may be me, not the sentence. I would perhaps have said "MSR_ARCH_CAPS
may have appeared with the microcode update."

> +     * Reload relevant fields in boot_cpu_data if so because they are
> +     * needed in tsx_init()

Nit: Missing full stop.

I also wonder whether you wouldn't want to insert "e.g.", since iirc with
the next patch tsx_init() isn't going to be the only user anymore.

> +     */
> +    if ( boot_cpu_data.cpuid_level >= 7 )
> +        boot_cpu_data.x86_capability[FEATURESET_7d0]
> +            = cpuid_count_edx(7, 0);

I take it we assume the maximum CPUID level won't go from below 7 to 7
or higher with the ucode update?

> --- a/xen/arch/x86/tsx.c
> +++ b/xen/arch/x86/tsx.c
> @@ -39,9 +39,9 @@ void tsx_init(void)
>      static bool __read_mostly once;
>  
>      /*
> -     * This function is first called between microcode being loaded, and 
> CPUID
> -     * being scanned generally.  Read into boot_cpu_data.x86_capability[] for
> -     * the cpu_has_* bits we care about using here.
> +     * This function is first called between microcode being loaded, and
> +     * CPUID being scanned generally. early_microcode_init() has already
> +     * prepared the feature bits needed here after the microcode update.

Is this true in all cases? early_microcode_init() may have bailed
early, so I think you need to further transform early_microcode_init()
(and as a personal request of mine preferably without goto).

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.