mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James McMechan <james_mcmechan@hotmail.com>
To: <richard@nod.at>, <mikpe@it.uu.se>
Cc: <linux-kernel@vger.kernel.org>,
	uml devel <user-mode-linux-devel@lists.sourceforge.net>
Subject: RE: [uml-devel] gcc-4.6.0 generates no code for sub_preempt_count()
Date: Thu, 14 Apr 2011 19:50:13 +0000	[thread overview]
Message-ID: <COL101-W165ED5CB17434202CE273DE2AD0@phx.gbl> (raw)
In-Reply-To: <201104141552.42213.richard@nod.at>


> Am Donnerstag 14 April 2011, 09:49:14 schrieb Mikael Pettersson:
> > Richard Weinberger writes:
> > > Hi,
> > >
> > > I'm facing a very strange issue with gcc-4.6.0 and UML.
> > > Within __local_bh_enable() gcc generates no code for
> > > sub_preempt_count().
> > >
> > > See:
> > > http://userweb.kernel.org/~rw/uml-gcc460/__local_bh_enable-gcc460.txt
> > > vs.
> > > http://userweb.kernel.org/~rw/uml-gcc460/__local_bh_enable-gcc431.txt
> > >
> > > Interestingly it generates code for add_preempt_count().
> > > I can reproduce this on x86 and x86_64.
> > >
> > > The problem has to do with UML's current_thread_info() function.
> > > When I replace it with arch/x86's (unportable) variant gcc generates
> > > code.
> > >
> > > Any ideas whether this is a gcc or a kernel issue?

It looks like a gcc error with one of the optimization passes

> > Please provide a standalone test case.
>
> There you go!
> http://userweb.kernel.org/~rw/uml-gcc460/testcase.c

Replacing inline with __attribute__((noinline)) makes it produce code again

without requiring asm("esp")/asm("rsp") tricks and the code appears to be working

I think gcc is assuming only low bits in the address of stack vars and thought they

were all masked out :( with this change my test version of gcc-4.6.0 works for x86/amd64

I have not yet gotten 4.6.0 to install yet so I was testing with xgcc from the failed build


--- testcase.orig       2011-04-14 08:34:24.000000000 -0700

+++ testcase.c  2011-04-14 12:17:44.000000000 -0700

@@ -31,7 +31,7 @@

 }

 #else

 /* UML */

-static inline struct thread_info *current_thread_info(void)

+static __attribute__((noinline)) struct thread_info *current_thread_info(void)

 {

   struct thread_info *ti;

   unsigned long mask = THREAD_SIZE - 1;>

> Thanks,
> //richard

 		 	   		  

  reply	other threads:[~2011-04-14 19:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-13 19:50 Richard Weinberger
2011-04-14  7:49 ` Mikael Pettersson
2011-04-14 13:52   ` Richard Weinberger
2011-04-14 19:50     ` James McMechan [this message]
2011-04-15 15:17       ` [uml-devel] " Richard Weinberger
2011-04-14 14:43 ` masterkom masterkom
2011-04-14 15:17   ` Frank Kingswood

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=COL101-W165ED5CB17434202CE273DE2AD0@phx.gbl \
    --to=james_mcmechan@hotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikpe@it.uu.se \
    --cc=richard@nod.at \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /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

all inboxes | Powered by JetHome®