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

Re: [PATCH] xen/arm32: Get rid of __memzero()


  • To: Julien Grall <julien@xxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Michal Orzel <michal.orzel@xxxxxxx>
  • Date: Wed, 27 Nov 2024 12:47:40 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=xen.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=cMI2NQsZ6stQEjH0utUjP6bgdByWISlbmqAeVZ5Y1bM=; b=Wh314b29HETtsoBVbRf0+Zdk96QBnopS+nwvDjeZBV/nkpya5CC5Xh8kGuYBMUxaTE1+na+in+gRW7PWFPEvW32X8VX+IhG1SN+GyauUbSHYrU00kZX8CdIQR2Q/g+hnhJIvFCwNTgixJGOCyi7KSYHo14uA/Dbzohdma4YcC+yBthMRhY7ycnV+dWyVUpfdpidFLzkbMoTa514jADrnjAIcKVGdFRhq6JxwkIbMbAbBb2Z590NENDTdBuFa4pe1EF9jYiU0JW1fckCw8i23aokgrBz5m0DkEIXtM9Pk7zOGC5H6KD/bgxSE3joXnrCi5SQgNnWAnMuN2SHA/5j4Rw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UMWZkQgrMCoFrv2ur/dvtjL6tQVhQMjh+XoG4jLTf7m7MDNw0rORaXZPJAtlfkPrUupxKniYgjPe2MXocqt4F5mgvSoe85aAxLIqlqffNiK6RnLI1DRP2P6Wu3BQ7jqtrQ9j9IbPgfZseffc0qaaRhbYELhGnjxLghJDlLIHMqo9jwtJ5VslJtOLRTKN+P5jTkHeOfMlEjPDIqA3S/CPVXth1lCRkq5XtgzCNlGX/mhBkILx8pnYkLu2B/Rwfk2DLPNUSihOftHHkfM+4WuWg+VlO6c7QD8pCCHcwInz2kXFOUqOOcNGhgXMR/9O69z1E+9gs0HqOWeRu6SxJnRRNw==
  • Cc: <jbeulich@xxxxxxxx>, Julien Grall <jgrall@xxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Wed, 27 Nov 2024 11:48:10 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>


On 27/11/2024 11:55, Julien Grall wrote:
> 
> 
> From: Julien Grall <jgrall@xxxxxxxxxx>
> 
> All the code in arch/arm32/lib/ where copied from Linux 3.16
> and never re-synced since then.
> 
> A few years ago, Linux got rid of __memzero() because the implementation
> is very similar to memset(p,0,n) and the current use of __memzero()
> interferes with optimization. See full commit message from Linux below.
> 
> So it makes sense to get rid of __memzero in Xen as well.
> 
>     From ff5fdafc9e9702846480e0cea55ba861f72140a2 Mon Sep 17 00:00:00 2001
>     From: Nicolas Pitre <nicolas.pitre@xxxxxxxxxx>
>     Date: Fri, 19 Jan 2018 18:17:46 +0100
>     Subject: [PATCH] ARM: 8745/1: get rid of __memzero()
> 
>     The __memzero assembly code is almost identical to memset's except for
>     two orr instructions. The runtime performance of __memset(p, n) and
>     memset(p, 0, n) is accordingly almost identical.
> 
>     However, the memset() macro used to guard against a zero length and to
>     call __memzero at compile time when the fill value is a constant zero
>     interferes with compiler optimizations.
> 
>     Arnd found tha the test against a zero length brings up some new
>     warnings with gcc v8:
> 
>       https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82103
> 
>     And successively rremoving the test against a zero length and the call
>     to __memzero optimization produces the following kernel sizes for
>     defconfig with gcc 6:
> 
>         text     data     bss       dec       hex  filename
>     12248142  6278960  413588  18940690   1210312  vmlinux.orig
>     12244474  6278960  413588  18937022   120f4be  vmlinux.no_zero_test
>     12239160  6278960  413588  18931708   120dffc  vmlinux.no_memzero
> 
>     So it is probably not worth keeping __memzero around given that the
>     compiler can do a better job at inlining trivial memset(p,0,n) on its
>     own. And the memset code already handles a zero length just fine.
> 
>     Suggested-by: Arnd Bergmann <arnd@xxxxxxxx>
>     Signed-off-by: Nicolas Pitre <nico@xxxxxxxxxx>
>     Acked-by: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx>
>     Acked-by: Arnd Bergmann <arnd@xxxxxxxx>
>     Signed-off-by: Russell King <rmk+kernel@xxxxxxxxxxxxxxx>
> 
> Origin: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
> ff5fdafc9e97
> Signed-off-by: Julien Grall <jgrall@xxxxxxxxxx>
In case you need Arm's ack apart from Jan's Rb:
Acked-by: Michal Orzel <michal.orzel@xxxxxxx>

~Michal




 


Rackspace

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