public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: "Dmitry V. Levin" <ldv@altlinux.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Andy Lutomirski <luto@kernel.org>
Cc: Elvira Khabirova <lineprinter0@gmail.com>,
	X86 ML <x86@kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86/signal: Cleanup get_nr_restart_syscall
Date: Fri, 18 Dec 2015 22:34:50 -0800	[thread overview]
Message-ID: <5674FA8A.60806@zytor.com> (raw)
In-Reply-To: <20151218233736.GA28013@altlinux.org>

On 12/18/15 15:37, Dmitry V. Levin wrote:
> Check for TS_COMPAT instead of TIF_IA32 to distinguish ia32 tasks
> from 64-bit tasks.
> Check for __X32_SYSCALL_BIT only if CONFIG_X86_X32_ABI is defined.
>
> Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
> Cc: Elvira Khabirova <lineprinter0@gmail.com>
> Cc: Andy Lutomirski <luto@amacapital.net>
> ---
>   arch/x86/kernel/signal.c | 13 ++++++++-----
>   1 file changed, 8 insertions(+), 5 deletions(-)
>
> diff --git a/arch/x86/kernel/signal.c b/arch/x86/kernel/signal.c
> index cb6282c..ff7dedc 100644
> --- a/arch/x86/kernel/signal.c
> +++ b/arch/x86/kernel/signal.c
> @@ -692,12 +692,15 @@ handle_signal(struct ksignal *ksig, struct pt_regs *regs)
>
>   static inline unsigned long get_nr_restart_syscall(const struct pt_regs *regs)
>   {
> -#if defined(CONFIG_X86_32) || !defined(CONFIG_X86_64)
> +#ifdef CONFIG_X86_64
> +	if (is_ia32_task())
> +		return __NR_ia32_restart_syscall;
> +# ifdef CONFIG_X86_X32_ABI
> +	if (regs->orig_ax & __X32_SYSCALL_BIT)
> +		return __NR_restart_syscall | __X32_SYSCALL_BIT;
> +# endif
> +#endif
>   	return __NR_restart_syscall;
> -#else /* !CONFIG_X86_32 && CONFIG_X86_64 */
> -	return test_thread_flag(TIF_IA32) ? __NR_ia32_restart_syscall :
> -		__NR_restart_syscall | (regs->orig_ax & __X32_SYSCALL_BIT);
> -#endif /* CONFIG_X86_32 || !CONFIG_X86_64 */
>   }
>
>   /*
>

I bet you actually made the code slower.

	-hpa


  reply	other threads:[~2015-12-19  6:35 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-07 23:22 [PATCH] x86/signal: fix restart_syscall number for x32 tasks Andy Lutomirski
2015-12-13  3:44 ` Dmitry V. Levin
2015-12-17 20:27   ` Andy Lutomirski
2015-12-18 23:37     ` [PATCH] x86/signal: Cleanup get_nr_restart_syscall Dmitry V. Levin
2015-12-19  6:34       ` H. Peter Anvin [this message]
2015-12-19 14:43         ` [PATCH v2] " Dmitry V. Levin
2015-12-19 20:48           ` Andy Lutomirski
2016-01-11 14:55             ` [RESEND PATCH " Dmitry V. Levin
2016-01-19 13:39               ` [tip:x86/asm] x86/signal: Cleanup get_nr_restart_syscall() tip-bot for Dmitry V. Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5674FA8A.60806@zytor.com \
    --to=hpa@zytor.com \
    --cc=ldv@altlinux.org \
    --cc=lineprinter0@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox