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

Re: [PATCH 2/5] x86/ucode: Fold early_update_cache() into microcode_init_cache()


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 29 Mar 2023 09:41:10 +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=hTj7jQmZ+aNviIf7tLtuPXsyLxN8QFlGO3m2R0eJ89c=; b=E8cuQ6LXWvpBRIpX0CZzFr0FtL/vJ8SNH8y9zB/imfpd1IM8Jl7qLkE3Hi/X0vjkccGbUp/XSEpQ6W4gPEqYKKZl1nfvrB+ducjEitufFpmUOzObVsYAcNrcwNPT5JSIGVcoXndK3RXIN5mQUGDbNHppgUdpKUkz2WXRTce5bf+p92vayYQDkLmRa0PpToeXcMvgxXavdwuzDtBIhB9bhPtU5eXP6VqUz/bi7bpULzJah6ua8wrFmknvfp7mL6gl7ajHY+VFg7kDwC5iyQo4RyFvF50VgFBQC2WDLpmp7jte1jFOV9jjvBdcS6WKV40Ss9b972w2x/z+BdLrRac0bw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GvJqda3PZ6dSQo0/3ZKE+hfFxgDWOVfgooKLe113jIYWgUez2/SKOr8oT/dTFzckJYeNqyhRxVFEzpaR1+KbzeDrtuhwJpPEYoiXLmI8inDk973hEGvUetHaktQ/nnTkU/FTgPOmSodmG3qy7b9VIZPdHoSn53ru/7QwT50lhX5FKvveC7E1gzAHlok7DIXX0xjwUkf5Bl4DCa+wTQtuiLa+pL7upkoTEDYc34pbgMe19OwUAHhpOUa8wmGN2OxzZXIkjX9ChdVBLKHcq+zyYwK6Wnx3SLmy/+w8KnKkiiYWL/sX7tKH7x7gGWtAPi/4IRxoNDIFZ6BWHvePy7ZzEQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Sergey Dyasli <sergey.dyasli@xxxxxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 29 Mar 2023 07:41:32 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 28.03.2023 17:07, Andrew Cooper wrote:
> On 28/03/2023 2:51 pm, Jan Beulich wrote:
>> On 27.03.2023 21:41, Andrew Cooper wrote:
>>> --- a/xen/arch/x86/cpu/microcode/core.c
>>> +++ b/xen/arch/x86/cpu/microcode/core.c
>>> @@ -755,47 +755,51 @@ int microcode_update_one(void)
>>>      return microcode_update_cpu(NULL);
>>>  }
>>>  
>>> -static int __init early_update_cache(const void *data, size_t len)
>>> +int __init microcode_init_cache(unsigned long *module_map,
>>> +                                const struct multiboot_info *mbi)
>>>  {
>>>      int rc = 0;
>>>      struct microcode_patch *patch;
>>> +    struct ucode_mod_blob blob = {};
>>>  
>>> -    if ( !data )
>>> -        return -ENOMEM;
>> This is lost afaict. To be in sync with earlier code ) think you want to ...
>>
>>> +    if ( ucode_scan )
>>> +        /* Need to rescan the modules because they might have been 
>>> relocated */
>>> +        microcode_scan_module(module_map, mbi);
>>> +
>>> +    if ( ucode_mod.mod_end )
>>> +    {
>>> +        blob.data = bootstrap_map(&ucode_mod);
>> ... check here instead of ...
>>
>>> +        blob.size = ucode_mod.mod_end;
>>> +    }
>>> +    else if ( ucode_blob.size )
>>> +    {
>>> +        blob = ucode_blob;
>>> +    }
>> (nit: unnecessary braces)
>>
>>> -    patch = parse_blob(data, len);
>>> +    if ( !blob.data )
>>> +        return 0;
>> ... here, making the "return 0" the "else" to the earlier if/else-if.
>>
>> Alternatively, if you think the -ENOMEM isn't sensible, I'm happy to
>> consider respective justification for its removal.
> 
> I'm a little on the fence here.  Nothing checks the return value at all,
> and nothing printed a failure previously either.

So how about switching both microcode_init_cache() and, considering
the similar aspect in patch 3, early_microcode_init() to return void?
There's hardly any use the caller can make of the return value; if an
error message was to be logged, it likely would better be logged
closer to the source of the error.

Jan



 


Rackspace

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