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

Re: [PATCH 2/2] x86/irq: Improve local_irq_restore() code generation and performance


  • To: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Tue, 21 Feb 2023 14:49:17 +0100
  • 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=LEmawrD/VsVa9EqwTbkEfCkcw4oEGdNj9/RTJNDBNqI=; b=cNV80TpRngt3stEOSjxRU/oF7XFWS4OOzEGaRLc0XwMklKFFLV0Rsi3+gtR9KMiGFDEVOyPK3rb57+6s55y4YMcCpCgBdlzn6xYHwZHgtwxxvEUlESmOoQR7k0AokUTBIjbT4eBiqwnMUXVYa8Smf7hZy7KOSvHP4xsHxnpnb789CwOK2Rst8H80Lk+JAmdO2L0RLs80ry+ZAbfMnQLzHGRw3hx/0inTT/Sev3zUq56e1L5EwuXr8+bGdWtnxvu9Y+EsBi0L6bSx6w9rwrjXP9hIiGFJ9blI2OV6vInaWAJBp9+pxWQ5aRn3uO/NgfVTOOwfnL4v4boqHFqZtoAWmg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DzQ5Q5kQegwMlaA1ufnT6EUWuZshvTddGzTKiaNetFS5gT0BCpZ/xPCTwjP6J4+k2+eJSPryjUnRWSma10DDmV8w1pXEZJFehxIXy6EIRAkSLP9oJyc7TvC0UrYKWtotZvKwiC6CTrOsgswnsxiyYFljqhpDPRuc05j3w8CZroqoZJ6Ep2C94Mxsh8BH1ZyuOXK4lCyPAWwp1muMUOBfwIGNmWMnpuCUSj2/ymJfuYK09t8ksf3NFO3v6bECoAjEbRwbwaoE+KxbiEEwOInNze6DmeSvPGVIFEakZinDbz5En2GNVcF8MyleYw+8zcn2p6vuGYpqsBStJekAwYmXoQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Tue, 21 Feb 2023 13:49:27 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 20.02.2023 20:47, Andrew Cooper wrote:
> --- a/xen/arch/x86/include/asm/system.h
> +++ b/xen/arch/x86/include/asm/system.h
> @@ -267,13 +267,8 @@ static inline unsigned long 
> array_index_mask_nospec(unsigned long index,
>  })
>  #define local_irq_restore(x)                                     \
>  ({                                                               \
> -    BUILD_BUG_ON(sizeof(x) != sizeof(long));                     \
> -    asm volatile ( "pushfq\n\t"                                  \
> -                   "andq %0, (%%rsp)\n\t"                        \
> -                   "orq  %1, (%%rsp)\n\t"                        \
> -                   "popfq"                                       \
> -                   : : "i?r" ( ~X86_EFLAGS_IF ),                 \
> -                       "ri" ( (x) & X86_EFLAGS_IF ) );           \
> +    if ( (x) & X86_EFLAGS_IF )                                   \
> +        local_irq_enable();                                      \
>  })

Without it being written down anywhere that IRQs cannot be turned off
this way, and without there being a reference to that documentation
in the description, this is introducing a plain bug; I'm sorry to say
it that way. With both of the above fulfilled I'd of course be happy
to see the improvement take effect.

Jan



 


Rackspace

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