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

Re: [PATCH v3 01/10] xen/version: Calculate xen_capabilities_info once at boot


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 16 Aug 2023 08:48:08 +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=dGHNMfFy1kDIWbXKm/Mw83ZPFgVnV1dUZNtPWMS6o1w=; b=a+uzSGFD/FlD6kkWGFkwuWznyaBSNwqvq0dy3yppK8jYG5rXq+dkexyyKbN4mxgic1Apgy1eRIHOtUK3A3BThWL9siYACDR7mvOr5hqx4v5gXjwJvYxziLS2T682N6CqbevSq/yFQPjlIRtlwyO8AjjogBJVWqZ32cZI4VNNY9ByDqsrfMnKruuZmdRUHdmBgoS5til4sBxjIkQPk/JBLKjgN9KR5ex+CQ02ER8sw5E7GV6V30aj40JTgxoGJZ3euMGQYCV4iGISU2MxCh+6l5S/WvwbNvWavVOzA5O04Piq4C62ehhRZkcExMZvLxz2LyTYJ9wpdd4B2qrUWuFpqQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=chkwCtzDKJcCEsREc730T4iPZRqiXmyNR9KJ6M8FoCfDc3UHNzPGji/CBH7PYcT1SOqkCNSoI/t+htt6pNMljfZQXfWy4U6vwZzEv5xH6b4KBztRxtSEIObg7zl/I2W5iLm0siKLXZ0ZMLrl0gBNexcSR7/J2xuVMQaBQ3cQh+2zWcgRK1crr3Oqlh6zdwwQEiFK2u26/09XeqxWPShZEFLJuQRElllXfsZ3O2kATTVS6G+5HW4vJF7BJDkSXUamSf+NeLV/CdkKjU5fllOE+e5wpkni+x/6X4FUED2CMdSEZfzmz18+R90l7yqLf5BJAPmaeEYxnR6SJasRtbhFGQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Julien Grall <julien@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, Shawn Anastasio <sanastasio@xxxxxxxxxxxxxxxxxxxxx>, Henry Wang <Henry.Wang@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • Delivery-date: Wed, 16 Aug 2023 06:48:24 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 16.08.2023 01:03, Stefano Stabellini wrote:
> On Tue, 15 Aug 2023, Andrew Cooper wrote:
>> The arch_get_xen_caps() infrastructure is horribly inefficient for something
>> that is constant after features have been resolved on boot.
>>
>> Every instance used snprintf() to format constants into a string (which gets
>> shorter when %d gets resolved!), and which get double buffered on the stack.
>>
>> Switch to using string literals with the "3.0" inserted - these numbers
>> haven't changed in 18 years (The Xen 3.0 release was Dec 5th 2005).
>>
>> Use initcalls to format the data into xen_cap_info, which is deliberately not
>> of type xen_capabilities_info_t because a 1k array is a silly overhead for
>> storing a maximum of 77 chars (the x86 version) and isn't liable to need any
>> more space in the forseeable future.
>>
>> This speeds up the the XENVER_capabilities hypercall, but the purpose of the
>> change is to allow us to introduce a better XENVER_* API that doesn't force
>> the use of a 1k buffer on the stack.
>>
>> Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> 
> Reviewed-by: Stefano Stabellini <sstabellini@xxxxxxxxxx>

Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
albeit I still think your original concern regarding ...

>> @@ -537,7 +538,7 @@ long do_xen_version(int cmd, 
>> XEN_GUEST_HANDLE_PARAM(void) arg)
>>  
>>          memset(info, 0, sizeof(info));
>>          if ( !deny )
>> -            arch_get_xen_caps(&info);
>> +            safe_strcpy(info, xen_cap_info);
>>  
>>          if ( copy_to_guest(arg, info, ARRAY_SIZE(info)) )
>>              return -EFAULT;

... the unhelpful use of a stack variable here could do with addressing.
But of course that can equally be done in a subsequent patch.

Jan



 


Rackspace

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