public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Lutomirski <luto@amacapital.net>
To: "H. Peter Anvin" <hpa@zytor.com>,
	behanw@converseincode.com, tglx@linutronix.de, mingo@redhat.com,
	x86@kernel.org, peterz@infradead.org, ak@linux.intel.com,
	oleg@redhat.com
Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] x86: LLVMLinux: Reimplement current_stack_pointer without register usage.
Date: Tue, 25 Feb 2014 19:00:29 -0800	[thread overview]
Message-ID: <530D58CD.4080202@mit.edu> (raw)
In-Reply-To: <5306DC49.4060603@zytor.com>

On 02/20/2014 08:55 PM, H. Peter Anvin wrote:
> This seems like really deep magic when looking at it... at the very
> least, this needs to be very carefully commented, including why it works
> on the various platforms.
> 
> How much does this actually affect the output?  I only see three uses of
> current_stack_pointer:
> 
> /* how to get the thread information struct from C */
> static inline struct thread_info *current_thread_info(void)
> {
>         return (struct thread_info *)
>                 (current_stack_pointer & ~(THREAD_SIZE - 1));
> }
> 
> ... here we need the mov anyway, because we have to then AND it with a
> mask, which we obviously can't do inside the stack pointer.

No clue what code is actually generated, but the new code could generate:

mov $MASK, %rax;
and %esp, %rax;

Admittedly, I can't see any reason why this would be an improvement.

--Andy

  reply	other threads:[~2014-02-26  3:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-21  4:44 [PATCH] x86: LLVMLinux: Reimplement current_stack_pointer without register usage behanw
2014-02-21  4:55 ` H. Peter Anvin
2014-02-26  3:00   ` Andy Lutomirski [this message]
2014-02-26  3:03     ` H. Peter Anvin

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=530D58CD.4080202@mit.edu \
    --to=luto@amacapital.net \
    --cc=ak@linux.intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=behanw@converseincode.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --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