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

Re: [PATCH] xen/arm: acpi: Include header file for version number


  • To: Julien Grall <julien@xxxxxxx>
  • From: Bertrand Marquis <Bertrand.Marquis@xxxxxxx>
  • Date: Wed, 7 Sep 2022 08:30:27 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=2; mx.microsoft.com 1; spf=pass (sender ip is 63.35.35.123) smtp.rcpttodomain=lists.xenproject.org smtp.mailfrom=arm.com; dmarc=pass (p=none sp=none pct=100) action=none header.from=arm.com; dkim=pass (signature was verified) header.d=armh.onmicrosoft.com; arc=pass (0 oda=1 ltdi=1 spf=[1,1,smtp.mailfrom=arm.com] dkim=[1,1,header.d=arm.com] dmarc=[1,1,header.from=arm.com])
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=2; 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=YLaeFlk/kicynYXZyl3aqVFLxJM3MTSAbQJJsjYoN5U=; b=IFdvpX2qrIgWMwTPHfeg8h21p8li/8BTyDPh8UGj5ycNiNgxe7aZ+y03f9UtBjlj4IV3L/8yGiQZ+6rHGk0tGOXfLcVJFz7H6xJyeB6X+jwGLpDVz1M+8KEq0ohI9S1UGQGXGsq1wNDOarXJBvaePw0i07JKFiINFZJOpXFinrMfLvqKaHe6OrlaEGEtwrLQ8Vnaq1l2MBpEisSl14oApA053ZG5wOdFLQfuUIXKM4gfo+Ex9JQ/0MiDQkN0gxUTzJN0m2aNrtKvWWjxLWzPXcOKTAT/JbGGaTxFO8D/Qfe79ajRivsksWf9vqbcqc7GnSF9/Zt1cLuVeAV4psCfpA==
  • 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=YLaeFlk/kicynYXZyl3aqVFLxJM3MTSAbQJJsjYoN5U=; b=aXj/++6cPWSVyTUwvknPBJww0SRYHs6CaxqaWX/AfroFdfOc5C6JdNJR6GDpBipE2XD/DLPchvA7LFhJ5s8HhWp0k9KKNBU5EcuY25b9eroCzH98py0gSOAOIrI1DB6rRBxahaLv+eqhGz2tt2KpGAsT4KV2vepScv+rA9HtwfTzAULuGIkEbemot7gZMaCKkalIRYEC1vqyXw0HWAD9PHl6uxfF+bYGtwFF1fR6+Lm8dcUZMTX2yRUk9kkTntAxWwOy0TCk/7qFlN/DtMBAoBLnjdyssfty4ll0M1tPouz8QQfqeK4a7AMsmqjdfWRdVwhPiZ6eyVklZ5yBxbBIDg==
  • Arc-seal: i=2; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=pass; b=OplswqilE8h2zyC8B7WTwpLFrtTRbMPEtqQrFf82xBKybvqNad90iYr7+R//v3FS5VAGWFbs+CV8o5xUW1aBKanaxug5nkz+nMAUp07BjKPUyDYVZTgz8dQL9w+Vh7CYXqx/vgUvzkyfAFUjJoAoCJIGEtA0f7rlRJ1OwsEPJd7p2Zl1fgTDHfVLp1ixzrKHLwHBAdsNLLGEykPC7n510v49ufBL1Ydw64bzfv1lfp2yaWhLPyZtTVrYjcX0LPR+aePRzeGKj0x4quMOoperHKkggiWN/JeBz7Gp0uEl1BTsGO2ahOyVYq2UY8dvDcGvNMAcMQshY3QRJf2BOlfOsQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bp7FDeWMYf6LupGyVBRa2KxGWDHlnb0jgAGVahA34kX27Fho23ZYMfTBx/PyqB6GoO3XBXMzeHiwoAclAr6hK76UzGYX8b9gy3iZZGzKm9ufVahbR5vvslQHRZURoeP2k8/iViRa20cVJZKBFG91ffMFTvM9x00MmVUZ2TeOWBWabT0+8A0DP6c7H7ioX6oDq5RLX6huv05TCgY3kQGtyzFvG1K2ddRvhM8KdE/IjtSz0gBmWBVr2yqztc9fhGTdtP0o4M+AX8SUb4MSxHoh8Evsf9tTgQ5Sdq8CoER/QsNEP05TihYbwSK+dSHSu9pAa5935RuWp1yjM5xTlYHR8A==
  • Authentication-results-original: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Cc: "leo.yan@xxxxxxxxxx" <leo.yan@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 07 Sep 2022 08:30:45 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHYweQzyVikzADCFE2Bfo+zYT5rgq3ToyoAgAABNgA=
  • Thread-topic: [PATCH] xen/arm: acpi: Include header file for version number

Hi Julien,

> On 7 Sep 2022, at 09:26, Julien Grall <julien@xxxxxxx> wrote:
> 
> Hi Leo,
> 
> On 06/09/2022 12:31, Leo Yan wrote:
>> On Arm64 Linux kernel prints log for Xen version number:
>>   [    0.000000] Xen XEN_VERSION.XEN_SUBVERSION support found
>> Because the header file "xen/compile.h" is missed, XEN_VERSION and
>> XEN_SUBVERSION are not defined, thus compiler directly uses the
>> string "XEN_VERSION" and "XEN_SUBVERSION" in the compatible string.
>> This patch includes the header "xen/compile.h" which defines macros for
>> XEN_VERSION and XEN_SUBVERSION, thus Xen can pass the version number via
>> hypervisor node.
>> Signed-off-by: Leo Yan <leo.yan@xxxxxxxxxx>
> 
> AFAICT, the problem was introduced when we split the ACPI code from 
> arch/domain_build.c. So I would add the following tag:
> 
> Fixes: 5d797ee199b3 ("xen/arm: split domain_build.c")
> 
> Now, this means we shipped Xen for ~4 years with the wrong compatible. The 
> compatible is meant to indicate the Xen version. However, I don't think this 
> is used for anything other than printing the version on the console.
> 
> Also, the problem occurs only when using ACPI. This is still in tech preview, 
> so I think we don't need to document the issue in the documentation (we can 
> easily break ABI).
> 
>> ---
>>  xen/arch/arm/acpi/domain_build.c | 1 +
>>  1 file changed, 1 insertion(+)
>> diff --git a/xen/arch/arm/acpi/domain_build.c 
>> b/xen/arch/arm/acpi/domain_build.c
>> index bbdc90f92c..2649e11fd4 100644
>> --- a/xen/arch/arm/acpi/domain_build.c
>> +++ b/xen/arch/arm/acpi/domain_build.c
>> @@ -9,6 +9,7 @@
>>   * GNU General Public License for more details.
>>   */
>>  +#include <xen/compile.h>
> 
> So this is fixing the immediate problem. Given the subtlety of the bug, I 
> think it would be good to also harden the code at the same time.

I think we should commit the patch as is and harden the code in a subsequent 
patch.

> 
> I can see two way to do that:
>  1) Dropping the use of __stringify
>  2) Check if XEN_VERSION and XEN_SUBVERSION are defined
> 
> The latter is probably lightweight. This could be added right next to 
> acpi_make_hypervisor_node() for clarify.
> 
> Something like:
> 
> #ifndef XEN_VERSION
> # error "XEN_VERSION is not defined"
> #endif
> 
> #ifndef XEN_SUBVERSION
> # error "XEN_SUBVERSION is not defined"
> #endif
> 
> Could you have a look?

There are actually several places in the code where we use the stringify system.
Would it make sense to actually have a string version provided in compile.h and 
use it instead ?

Otherwise if we start adding those kinds of checks, we will have to add them in 
at least 3 places in xen code.

Cheers
Bertrand

> 
>>  #include <xen/mm.h>
>>  #include <xen/sched.h>
>>  #include <xen/acpi.h>
> 
> Cheers,
> 
> -- 
> Julien Grall




 


Rackspace

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