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

Re: compat code lacks support for __attribute__


  • To: Olaf Hering <olaf@xxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 14 Jun 2023 11:49:35 +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=UG3CN7y5ALcWwbVCs5KJLsIk+zG5RVr6nb0qeMVpp/I=; b=M75qOXIgMsxxuc4owk/3RHB3WsAqwI43plRS+Vpxd1RmmmW89e1Pn0kVbOSeupcCHsN9X7sMZTPQoUdb69CO4G79riBMO41RHr1pOY5CfDNwZOdcA4jd9RpY93z+jgwzYFvmYpnTICtGBw2zPrfJRfeBVzwWLxhvegu81NIla1zdiPawqIz0Qs73EOgNKL/cocwt8zhv0XXCO0EON7xeHR09lC5jl8HA910+7thnJsmeXEKjUxEqpbIkdK+j1PNdM3vAANlPhMLsmqO4adhuxhBEQc5Jfdbv1dqk1y/rD8lWmf5KBHo8OSSr96dnNvYLKdvgieLTxOeo6ZM8izHc0A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T4V/G4KXpp5RPkmwL58q03Gk9Au51XyqvmB4+TDltT1AD6YUnsGAxlt7uiKvL2mkPMv9EQ/Wk0ln6SLAGRcJIOlOlkwr++JyBqsgdejWDZgc5L8OKF1L4e0T+YaLFaElvLQcG/Cp31+lr5jKHSA60ZAq11JrpfrC/ZsjL6V02X8act3WIEp6wXeL6mri+LxxmLXsjKapUI0iuGhsB28NqFtVxQIxhdPGdULHplhkwJ/ME6A/sjH7QZaod6VdrdrMk+gD/Y0qwG3/YFzZrAv3fmBBAqH50yjdaQRiwrCcAiTc27o4oguUrKpAfq9PqtktojBE8LAp+QRqrXyg5locCA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Wed, 14 Jun 2023 09:49:44 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 14.06.2023 10:43, Olaf Hering wrote:
> I would like to share code between the hypervisor and xenalyze, so that
> every definition comes from a single place and is not duplicated in xen
> and xenalyze. This works as long as simple constructs like struct x {};
> are used. Depending on the data to be stored into the trace buffer, having
> support for __packed may reduce the amount of data that need to be copied.
> 
> The tooling currently converts ___attribute__ into compat___attribute__.
> Was support for __attribute__ intentionally left out, or was there just
> no usecase for it?

It was intentionally left out, as the public headers that are subject
to compat translation are supposed to not use any compiler extensions.
See also our checking that these headers build in plain ANSI C mode
(which of course doesn't catch all possible cases, as macros would
need actually using in order to spot issues).

However, if you're after adding packed attributes, and if you're
meaning to only communicate between Xen and the tool stack, then
the requirement above doesn't exist. Yet then I would also wonder
whether you need any compat translation in the first place. Those
packed structures would better be arch-/bitness-agnostic, wouldn't
they? So perhaps we could arrange for your additions to be excluded
from the compat translation machinery?

Another option to consider might be to use #pragma pack instead of
packed attributes. (I can't say off the top of my head whether such
#pragma-s would survive the translation.)

Jan



 


Rackspace

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