Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Behan Webster <behanw@converseincode.com>
To: Daniel Sanders <daniel.sanders@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	Paul Burton <paul.burton@imgtec.com>,
	Markos Chandras <markos.chandras@imgtec.com>,
	James Hogan <james.hogan@imgtec.com>,
	linux-mips@linux-mips.org,
	Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>,
	David Daney <ddaney.cavm@gmail.com>
Subject: Re: [PATCH v3] MIPS: Changed current_thread_info() to an equivalent supported by both clang and GCC
Date: Tue, 24 Feb 2015 11:29:59 -0800	[thread overview]
Message-ID: <54ECD137.3000202@converseincode.com> (raw)
In-Reply-To: <1424790177-10089-1-git-send-email-daniel.sanders@imgtec.com>

On 02/24/15 07:02, Daniel Sanders wrote:
> Without this, a 'break' instruction is executed very early in the boot and
> the boot hangs.
>
> The problem is that clang doesn't honour named registers on local variables
> and silently treats them as normal uninitialized variables. However, it
> does honour them on global variables.
>
> Signed-off-by: Daniel Sanders <daniel.sanders@imgtec.com>
> Cc: Ralf Baechle <ralf@linux-mips.org>
> Cc: Paul Burton <paul.burton@imgtec.com>
> Cc: Markos Chandras <markos.chandras@imgtec.com>
> Cc: James Hogan <james.hogan@imgtec.com>
> Cc: linux-mips@linux-mips.org
> Cc: Behan Webster <behanw@converseincode.com>
> Cc: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
> Cc: David Daney <ddaney.cavm@gmail.com>
> ---
> v2 of this patch has been updated following David Daney's request to preserve
> the name of the original named register local.
>
> v3 of this patch just rebases to master and adds some background discussion from
> the previous threads.
>
> For reference, a similar patch for ARM's stack pointer has already been merged:
>   0abc08b ARM: 8170/1: Add global named register current_stack_pointer for ARM
>
> LLVM is unlikely to support uninitialized reads of named register locals in the
> foreseeable future. There are some significant implementation difficulties and
> there were objections based on the future direction of LLVM. The thread is at
> http://lists.cs.uiuc.edu/pipermail/llvmdev/2014-March/071555.html. I've linked
> to the bit where the issues started to be discussed rather than the start of
> the thread.
>
> Difficulty and objections aside, it's also a very large amount of work to
> support a single (as far as I know) user of named register locals, especially
> when the kernel has already accepted patches to switch named register locals to
> named register globals in the arm and arm64/aarch64 arches.
>
>  arch/mips/include/asm/thread_info.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/arch/mips/include/asm/thread_info.h b/arch/mips/include/asm/thread_info.h
> index 55ed660..2f0dba3 100644
> --- a/arch/mips/include/asm/thread_info.h
> +++ b/arch/mips/include/asm/thread_info.h
> @@ -55,10 +55,10 @@ struct thread_info {
>  #define init_stack		(init_thread_union.stack)
>  
>  /* How to get the thread information struct from C.  */
> +register struct thread_info *__current_thread_info __asm__("$28");
> +
>  static inline struct thread_info *current_thread_info(void)
>  {
> -	register struct thread_info *__current_thread_info __asm__("$28");
> -
>  	return __current_thread_info;
>  }
>  

Acked-by: Behan Webster <behanw@converseincode.com>

-- 
Behan Webster
behanw@converseincode.com

      parent reply	other threads:[~2015-02-24 19:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24 15:02 [PATCH v3] MIPS: Changed current_thread_info() to an equivalent supported by both clang and GCC Daniel Sanders
2015-02-24 15:02 ` Daniel Sanders
2015-02-24 19:29 ` Behan Webster [this message]

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=54ECD137.3000202@converseincode.com \
    --to=behanw@converseincode.com \
    --cc=daniel.sanders@imgtec.com \
    --cc=ddaney.cavm@gmail.com \
    --cc=james.hogan@imgtec.com \
    --cc=linux-mips@linux-mips.org \
    --cc=markos.chandras@imgtec.com \
    --cc=paul.burton@imgtec.com \
    --cc=ralf@linux-mips.org \
    --cc=sergei.shtylyov@cogentembedded.com \
    /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