[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v4 2/2] x86/ucode/AMD: late load the patch on every logical thread
- To: Sergey Dyasli <sergey.dyasli@xxxxxxxxx>
- From: Jan Beulich <jbeulich@xxxxxxxx>
- Date: Tue, 21 Feb 2023 15:03:40 +0100
- 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=eFs7A2VAug61hvU98LDtRRrgTXr58yHOjvk5+u07sK8=; b=ZO7P6WCdoK1JSF0oHeLoKdlaSiL7ZU2/rgnePcGNPzgbYvBOj27rEJNpnwT9/Dlwuf02s219uoA5mm4q2S039iIIr06TKjxMNwxss/3JcuixVCoDxP9ViIffrwsKaTBARedqirTUj8LBpUcAq3wp4gwYBz7Iweq3mjA659bfAZ5xzn4KWjIRGIML0r3uyHO0wPNzll1c9HPCfJ2wCgsBTVxeRX/YBh7lYewlgXdibQZXCL/GR1RTi8vC9+cIoaktJ12UjxmU6auzmhZNicvIx5NH99MRz4RXOHlU8Zy/vwrtCt+t6mHrN/XwQZ+iE2S91SwRNlk+tQUjip+GQ/wPUA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GslxS+YPckaCdg9KtV27AF+/uI6jh/d+rdfPJa0FEEpXDfocSbkezTXxtV9G5OhI6PgIkqr3pp/ooPZ9Y5TiUyMvGjkb6te6Z5lfh/YxtMSldm/OLRCaprppZrcvKMewKi9r/oR+8AU6woFCzMGd57/2fDwm2DW6KLOVI9av8XeHSEJi4GlgC+mr1DmIANv976vE4RVVARePl5KopHmAuKHhhF15YOB16cC3RVEdxQWgvAYZLKFh5+T5uXQz7lC76QBt6nVTGKUaop6zyyMDzL0PZlyQcYGgrrZpOMyDSY5K+/6jvqUS8v1nJrCFjTlSkfbdc6dvtoWIczzi/vlnug==
- 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>, Sergey Dyasli <sergey.dyasli@xxxxxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
- Delivery-date: Tue, 21 Feb 2023 14:04:03 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 15.02.2023 16:38, Sergey Dyasli wrote:
> --- a/xen/arch/x86/cpu/microcode/core.c
> +++ b/xen/arch/x86/cpu/microcode/core.c
> @@ -398,10 +398,16 @@ static int cf_check microcode_nmi_callback(
> (!ucode_in_nmi && cpu == primary) )
> return 0;
>
> - if ( cpu == primary )
> + if ( boot_cpu_data.x86_vendor == X86_VENDOR_AMD )
Given their origin, I'm pretty certain Hygon wants treating the same here
and below.
> + /* load ucode on every logical thread/core */
> ret = primary_thread_work(nmi_patch);
> else
> - ret = secondary_nmi_work();
> + {
> + if ( cpu == primary )
> + ret = primary_thread_work(nmi_patch);
> + else
> + ret = secondary_nmi_work();
> + }
May I ask to get away with less code churn and less overall indentation?
Already
if ( boot_cpu_data.x86_vendor == X86_VENDOR_AMD )
/* load ucode on every logical thread/core */
ret = primary_thread_work(nmi_patch);
else if ( cpu == primary )
ret = primary_thread_work(nmi_patch);
else
ret = secondary_nmi_work();
would be shorter, but I don't see anything wrong with simply going with
if ( cpu == primary ||
/* Load ucode on every logical thread/core: */
(boot_cpu_data.x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON) )
ret = primary_thread_work(nmi_patch);
else
ret = secondary_nmi_work();
Same again further down, I believe.
Jan
|