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

Re: [PATCH 3/8] gnttab: Remove unused-but-set variable


  • To: Michal Orzel <michal.orzel@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • Date: Wed, 27 Apr 2022 12:33:53 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=jcSWMsu+ye1FmhpUtNcMpYFV8lPJ0FX4pB78h56vxjE=; b=c1EvqSSrV+y8zJeufToGuYHgEH/vQXi3AzOI6Baa7hLQv4npN4IlwKosLjA8OJaOFTZ/n4pwnXPabT8D3Rm7pCRbshM9/FmzC8RW3ZGfB8mwiCHc9/8z9EBbXUalBQOKoJZCIXX/4FKQxQePeS5td4DtNi1fwvgflH7S/XAWU1j8Z9A0v7B9LU81UkZqN4IBskPXAbr7ulFnnHqlHNJz9woisPdQLI+3En0QMPrwbt8fHQvFkrrtRWgmnDSaMRmCX7NKPhBRrk4CuDEi1dHlno3EcLFzxC/ZtmrM987OXsGxPklD89syX26aIAtAN19hVKJ1HnY6SqLJwRLfGmI7WA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MZlsvSl40YEISjVcVSJ5Ac3TzvVIznr89U89ZLZw1Sva8kRmysaV0QVfgrV7aoQCcE6l7U1jnrO6rsdjQq3ESyDSWudR47wC2F6j8JA8Otw7b+IZ7Ipc6IZlzVWLC1s1D6JFKGvRvoltlt4HupriagDOnocjqUr59BSzvANCiiCnUkGArXlJLwop3Q6HuFLgT4Q/BP8zhj9wlc1Zepaz1wi935K+1MVw8eOfwJtSS364/u29m3sBXH+zSaLyJj+hq6KaS2zmDh0aZc0TRNNR4Qu2xQFI8H3D7y7BXScr/M1lkF/WmpDB9hb8hNw/hdx8na7xtM1GiiWK233aGRdlrA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
  • Cc: George Dunlap <George.Dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 27 Apr 2022 12:34:04 +0000
  • Ironport-data: A9a23:DkWCkKwBDmmrsItlrkl6t+cBxyrEfRIJ4+MujC+fZmUNrF6WrkUHy zRLD2rVb62LMTGnc9snaI7loR5QvMWAzNEyGlRuqCAxQypGp/SeCIXCJC8cHc8zwu4v7q5Dx 59DAjUVBJlsFhcwnj/0bv656yMUOZigHtIQMsadUsxKbVIiGX9JZS5LwbZj2NY024fhWmthh PupyyHhEA79s9JLGjp8B5Kr8HuDa9yr5Vv0FnRnDRx6lAe2e0s9VfrzFonoR5fMeaFGH/bSe gr25OrRElU1XfsaIojNfr7TKiXmS1NJVOSEoiI+t6OK2nCuqsGuu0qS2TV1hUp/0l20c95NJ Npl65uNE1kWOKP3huEWdAJmTHtBFK5X9+qSSZS/mZT7I0zuVVLJmq8rKX5seIoS96BwHH1E8 uEeJHYVdBefiumqwbW9DO5xmsAkK8qtN4Qa0p1i5WiBUbB6HtadHeOWube03x9p7ixKNd/Ya 9AUdnxEaxPYbgcUElwWFIg/jKGjgXyXnzhw9wrJ+fNmuTa7IApZ0Z7JbffeS8a2G8RZhEbHq mOa+VjyHURPXDCY4X/fmp62vcfKnCj7UYZUE6eq+/pCiUeWgGcUDXU+V1G2vP24gU6WQM9EJ gof/S9Ghaov8E2mSPHtUhv+p2SL1jYHQMZZGeA+7ACLy4LX7hyfC2xCSSROAPQ5sOcmSDps0 UWG9/v5CDoqvLCLRHa18raPsSj0KSUTNXUFZyIPUU0C+daLnW0ophfGT9ImFbHviNTwQGv02 2rS8HR4gKgPh8kW0an95UrAnz+nupnOSEgy+xnTWWWmqAh+YeZJerCV1LQS1t4YRK7xc7VLl CJsdxS2hAzWMaywqQ==
  • Ironport-hdrordr: A9a23:hYs+Uq4q+/bcUjwZxQPXwZGCI+orL9Y04lQ7vn2ZFiY5TiXIra qTdaogviMc0AxhI03Jmbi7Scq9qeu1z+843WBjB8bZYOCAghrmEGgC1/qu/9SEIUHDH4FmpM BdmsRFaeEYSGIK9foSgzPIXerIouP3lpxA7N22pxgCcegpUdAY0+4TMHf4LqQCfngjOXNPLu v42iMonVqdUEVSSv7+KmgOXuDFqdGOvonhewQ6Cxku7xTLpS+06ZbheiLonis2Yndq+/MP4G LFmwv26uGIqPeg0CLR0GfV8tB/hMbh8N1eH8aB4/JlaQkEyzzYJriJaYfy+Azdk9vfr2rCV+ O85SvICv4Drk85uFvF+CcFlTOQiArGoEWStGNwyUGT3fARAghKSvapzLgpDCcwoSAbza5B+b MO0GSDu5VNCxTc2Cz7+tjTThlv0lG5uHw4jIco/jRiuKYlGclsRLYkjQpo+VY7bVDHwZFiFP MrANDX5f5Qf1/fZ3fFvnN3yNjpWngoBB+JTkULp8TQilFt7TpE5lpdwNZakmYL9Zo7RZUB7+ PYMr5wnLULSsMNd6pyCOoIXMPyAG3QRhDHNn6UPD3cZeo6EmOIr4Sy7KQ+5emsdpBNxJwumI 7ZWFcdrmI2c1KGM7z44HSKyGG4fIyQZ0Wc9igF3ekJhlTVfsuZDQSTDFYzjsCnv/ITRsXGRv fbAuMiP8Pe
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHYWhwqFegaNlTxvU6FmW06six2Eq0DhsKAgAASwwCAABhegA==
  • Thread-topic: [PATCH 3/8] gnttab: Remove unused-but-set variable

On 27/04/2022 12:06, Michal Orzel wrote:
> Hi Jan,
>
> On 27.04.2022 11:59, Jan Beulich wrote:
>> On 27.04.2022 11:49, Michal Orzel wrote:
>>> Function unmap_common_complete defines and sets a variable ld that is
>>> later on passed to a macro gnttab_host_mapping_get_page_type. On arm
>>> this macro does not make use of any arguments causing a compiler to
>>> warn about unused-but-set variable (when -Wunused-but-set-variable is
>>> enabled). Fix this by removing ld and directly passing current->domain
>>> to gnttab_host_mapping_get_page_type.
>> I think we want to retain the ld / rd notation. Therefore I think it's
>> rather the Arm macro which wants adjusting to not leave this argument
>> unused.
>>
> I would agree provided that the ld variable was used in more than one place.
> As it is not, it does not seem very beneficial to keep a variable that is used
> just in one place and stores the macro value.
>
> When it comes to gnttab_host_mapping_get_page_type macro, on Arm it is 
> defined as (0)
> so modifying it seems to be a quite big overhead.

diff --git a/xen/arch/arm/include/asm/grant_table.h
b/xen/arch/arm/include/asm/grant_table.h
index d31a4d6805d6..9f68c2a37eb6 100644
--- a/xen/arch/arm/include/asm/grant_table.h
+++ b/xen/arch/arm/include/asm/grant_table.h
@@ -31,10 +31,10 @@ static inline void gnttab_mark_dirty(struct domain
*d, mfn_t mfn)
 
 int create_grant_host_mapping(unsigned long gpaddr, mfn_t mfn,
                               unsigned int flags, unsigned int
cache_flags);
-#define gnttab_host_mapping_get_page_type(ro, ld, rd) (0)
+#define gnttab_host_mapping_get_page_type(ro, ld, rd) (ro, ld, rd, 0)
 int replace_grant_host_mapping(unsigned long gpaddr, mfn_t mfn,
                                unsigned long new_gpaddr, unsigned int
flags);
-#define gnttab_release_host_mappings(domain) 1
+#define gnttab_release_host_mappings(domain) (domain, 1)
 
 /*
  * The region used by Xen on the memory will never be mapped in DOM0

It's about parameter evaluation, not about adding extra code when compiled.

~Andrew

 


Rackspace

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