All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	kernel test robot <xiaolong.ye@intel.com>,
	Ingo Molnar <mingo@kernel.org>, Andy Lutomirski <luto@kernel.org>,
	Borislav Petkov <bp@alien8.de>, Brian Gerst <brgerst@gmail.com>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>, Jiri Slaby <jslaby@suse.cz>,
	Mike Galbraith <efault@gmx.de>,
	Peter Zijlstra <peterz@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>, LKP <lkp@01.org>,
	linux-mm <linux-mm@kvack.org>, Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Christoph Lameter <cl@linux.com>
Subject: Re: [lkp-robot] [x86/kconfig] 81d3871900: BUG:unable_to_handle_kernel
Date: Wed, 18 Oct 2017 15:15:03 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1710181509310.1925@nanos> (raw)
In-Reply-To: <CA+55aFxVnFeFcjt=MW=_Uxx6S7nJh5eFxhQCamE5BG6Jr8MXfg@mail.gmail.com>

On Wed, 18 Oct 2017, Linus Torvalds wrote:
> On Tue, Oct 17, 2017 at 3:33 AM, Joonsoo Kim <iamjoonsoo.kim@lge.com> wrote:
> >
> > It looks like a compiler bug. The code of slob_units() try to read two
> > bytes at ffff88001c4afffe. It's valid. But the compiler generates
> > wrong code that try to read four bytes.
> >
> > static slobidx_t slob_units(slob_t *s)
> > {
> >   if (s->units > 0)
> >     return s->units;
> >   return 1;
> > }
> >
> > s->units is defined as two bytes in this setup.
> >
> > Wrongly generated code for this part.
> >
> > 'mov 0x0(%rbp), %ebp'
> >
> > %ebp is four bytes.
> >
> > I guess that this wrong four bytes read cross over the valid memory
> > boundary and this issue happend.
> 
> Hmm. I can see why the compiler would do that (16-bit accesses are
> slow), but it's definitely wrong.
> 
> Does it work ok if that slob_units() code is written as
> 
>   static slobidx_t slob_units(slob_t *s)
>   {
>      int units = READ_ONCE(s->units);
> 
>      if (units > 0)
>          return units;
>      return 1;
>   }
> 
> which might be an acceptable workaround for now?

Discussed exactly that with Peter Zijlstra yesterday, but we came to the
conclusion that this is a whack a mole game. It might fix this slob issue,
but what guarantees that we don't have the same problem in some other
place? Just duct taping this particular instance makes me nervous.

Joonsoo says:

> gcc 4.8 and 4.9 fails to generate proper code. gcc 5.1 and
> the latest version works fine.

> I guess that this problem is related to the corner case of some
> optimization feature since minor code change makes the result
> different. And, with -O2, proper code is generated even if gcc 4.8 is
> used.

So it would be useful to figure out which optimization bit is causing that
and blacklist it for the affected compiler versions.

Thanks,

	tglx

WARNING: multiple messages have this Message-ID (diff)
From: Thomas Gleixner <tglx@linutronix.de>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	kernel test robot <xiaolong.ye@intel.com>,
	Ingo Molnar <mingo@kernel.org>, Andy Lutomirski <luto@kernel.org>,
	Borislav Petkov <bp@alien8.de>, Brian Gerst <brgerst@gmail.com>,
	Denys Vlasenko <dvlasenk@redhat.com>,
	"H. Peter Anvin" <hpa@zytor.com>, Jiri Slaby <jslaby@suse.cz>,
	Mike Galbraith <efault@gmx.de>,
	Peter Zijlstra <peterz@infradead.org>,
	LKML <linux-kernel@vger.kernel.org>, LKP <lkp@01.org>,
	linux-mm <linux-mm@kvack.org>, Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Christoph Lameter <cl@linux.com>
Subject: Re: [lkp-robot] [x86/kconfig] 81d3871900: BUG:unable_to_handle_kernel
Date: Wed, 18 Oct 2017 15:15:03 +0200 (CEST)	[thread overview]
Message-ID: <alpine.DEB.2.20.1710181509310.1925@nanos> (raw)
In-Reply-To: <CA+55aFxVnFeFcjt=MW=_Uxx6S7nJh5eFxhQCamE5BG6Jr8MXfg@mail.gmail.com>

On Wed, 18 Oct 2017, Linus Torvalds wrote:
> On Tue, Oct 17, 2017 at 3:33 AM, Joonsoo Kim <iamjoonsoo.kim@lge.com> wrote:
> >
> > It looks like a compiler bug. The code of slob_units() try to read two
> > bytes at ffff88001c4afffe. It's valid. But the compiler generates
> > wrong code that try to read four bytes.
> >
> > static slobidx_t slob_units(slob_t *s)
> > {
> >   if (s->units > 0)
> >     return s->units;
> >   return 1;
> > }
> >
> > s->units is defined as two bytes in this setup.
> >
> > Wrongly generated code for this part.
> >
> > 'mov 0x0(%rbp), %ebp'
> >
> > %ebp is four bytes.
> >
> > I guess that this wrong four bytes read cross over the valid memory
> > boundary and this issue happend.
> 
> Hmm. I can see why the compiler would do that (16-bit accesses are
> slow), but it's definitely wrong.
> 
> Does it work ok if that slob_units() code is written as
> 
>   static slobidx_t slob_units(slob_t *s)
>   {
>      int units = READ_ONCE(s->units);
> 
>      if (units > 0)
>          return units;
>      return 1;
>   }
> 
> which might be an acceptable workaround for now?

Discussed exactly that with Peter Zijlstra yesterday, but we came to the
conclusion that this is a whack a mole game. It might fix this slob issue,
but what guarantees that we don't have the same problem in some other
place? Just duct taping this particular instance makes me nervous.

Joonsoo says:

> gcc 4.8 and 4.9 fails to generate proper code. gcc 5.1 and
> the latest version works fine.

> I guess that this problem is related to the corner case of some
> optimization feature since minor code change makes the result
> different. And, with -O2, proper code is generated even if gcc 4.8 is
> used.

So it would be useful to figure out which optimization bit is causing that
and blacklist it for the affected compiler versions.

Thanks,

	tglx

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Thomas Gleixner <tglx@linutronix.de>
To: lkp@lists.01.org
Subject: Re: [lkp-robot] [x86/kconfig] 81d3871900: BUG:unable_to_handle_kernel
Date: Wed, 18 Oct 2017 15:15:03 +0200	[thread overview]
Message-ID: <alpine.DEB.2.20.1710181509310.1925@nanos> (raw)
In-Reply-To: <CA+55aFxVnFeFcjt=MW=_Uxx6S7nJh5eFxhQCamE5BG6Jr8MXfg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1914 bytes --]

On Wed, 18 Oct 2017, Linus Torvalds wrote:
> On Tue, Oct 17, 2017 at 3:33 AM, Joonsoo Kim <iamjoonsoo.kim@lge.com> wrote:
> >
> > It looks like a compiler bug. The code of slob_units() try to read two
> > bytes at ffff88001c4afffe. It's valid. But the compiler generates
> > wrong code that try to read four bytes.
> >
> > static slobidx_t slob_units(slob_t *s)
> > {
> >   if (s->units > 0)
> >     return s->units;
> >   return 1;
> > }
> >
> > s->units is defined as two bytes in this setup.
> >
> > Wrongly generated code for this part.
> >
> > 'mov 0x0(%rbp), %ebp'
> >
> > %ebp is four bytes.
> >
> > I guess that this wrong four bytes read cross over the valid memory
> > boundary and this issue happend.
> 
> Hmm. I can see why the compiler would do that (16-bit accesses are
> slow), but it's definitely wrong.
> 
> Does it work ok if that slob_units() code is written as
> 
>   static slobidx_t slob_units(slob_t *s)
>   {
>      int units = READ_ONCE(s->units);
> 
>      if (units > 0)
>          return units;
>      return 1;
>   }
> 
> which might be an acceptable workaround for now?

Discussed exactly that with Peter Zijlstra yesterday, but we came to the
conclusion that this is a whack a mole game. It might fix this slob issue,
but what guarantees that we don't have the same problem in some other
place? Just duct taping this particular instance makes me nervous.

Joonsoo says:

> gcc 4.8 and 4.9 fails to generate proper code. gcc 5.1 and
> the latest version works fine.

> I guess that this problem is related to the corner case of some
> optimization feature since minor code change makes the result
> different. And, with -O2, proper code is generated even if gcc 4.8 is
> used.

So it would be useful to figure out which optimization bit is causing that
and blacklist it for the affected compiler versions.

Thanks,

	tglx

  reply	other threads:[~2017-10-18 13:16 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-10 12:15 [lkp-robot] [x86/kconfig] 81d3871900: BUG:unable_to_handle_kernel kernel test robot
2017-10-10 12:15 ` kernel test robot
2017-10-11  2:31 ` Josh Poimboeuf
2017-10-11  2:31   ` Josh Poimboeuf
2017-10-11  2:31   ` Josh Poimboeuf
2017-10-11 17:01   ` Josh Poimboeuf
2017-10-11 17:01     ` Josh Poimboeuf
2017-10-11 17:01     ` Josh Poimboeuf
2017-10-12 17:05     ` Christopher Lameter
2017-10-12 17:05       ` Christopher Lameter
2017-10-12 17:54       ` Linus Torvalds
2017-10-12 17:54         ` Linus Torvalds
2017-10-12 17:54         ` Linus Torvalds
2017-10-12 18:48         ` Andrew Morton
2017-10-12 18:48           ` Andrew Morton
2017-10-12 18:48           ` Andrew Morton
2017-10-12 19:19           ` Geert Uytterhoeven
2017-10-12 19:19             ` Geert Uytterhoeven
2017-10-12 19:19             ` Geert Uytterhoeven
2017-10-12 17:54       ` Linus Torvalds
2017-10-12 17:54         ` Linus Torvalds
2017-10-12 17:54         ` Linus Torvalds
2017-10-13  4:45       ` Josh Poimboeuf
2017-10-13  4:45         ` Josh Poimboeuf
2017-10-13  4:45         ` Josh Poimboeuf
2017-10-13 13:56         ` Andrey Ryabinin
2017-10-13 13:56           ` Andrey Ryabinin
2017-10-13 13:56           ` Andrey Ryabinin
2017-10-13 16:19           ` Josh Poimboeuf
2017-10-13 16:19             ` Josh Poimboeuf
2017-10-13 16:19             ` Josh Poimboeuf
2017-10-13 19:09           ` Linus Torvalds
2017-10-13 19:09             ` Linus Torvalds
2017-10-13 19:09             ` Linus Torvalds
2017-10-13 19:09             ` Linus Torvalds
2017-10-13 20:01             ` Andy Lutomirski
2017-10-13 20:01               ` Andy Lutomirski
2017-10-13 20:01               ` Andy Lutomirski
2017-10-13 20:01               ` Andy Lutomirski
2017-10-13 20:17             ` Jeffrey Walton
2017-10-13 20:17               ` Jeffrey Walton
2017-10-13 20:17               ` Jeffrey Walton
2017-10-13 15:22         ` Christopher Lameter
2017-10-13 15:22           ` Christopher Lameter
2017-10-13 15:37           ` Josh Poimboeuf
2017-10-13 15:37             ` Josh Poimboeuf
2017-10-13 15:37             ` Josh Poimboeuf
2017-10-17  7:33     ` Joonsoo Kim
2017-10-17  7:33       ` Joonsoo Kim
2017-10-17  7:33       ` Joonsoo Kim
2017-10-17  7:50       ` Thomas Gleixner
2017-10-17  7:50         ` Thomas Gleixner
2017-10-17  7:50         ` Thomas Gleixner
2017-10-18  7:31         ` Joonsoo Kim
2017-10-18  7:31           ` Joonsoo Kim
2017-10-18  7:31           ` Joonsoo Kim
2017-10-18 10:40       ` Linus Torvalds
2017-10-18 10:40         ` Linus Torvalds
2017-10-18 10:40         ` Linus Torvalds
2017-10-18 13:15         ` Thomas Gleixner [this message]
2017-10-18 13:15           ` Thomas Gleixner
2017-10-18 13:15           ` Thomas Gleixner
2017-10-19  2:14           ` Joonsoo Kim
2017-10-19  2:14             ` Joonsoo Kim
2017-10-19  2:14             ` Joonsoo Kim

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=alpine.DEB.2.20.1710181509310.1925@nanos \
    --to=tglx@linutronix.de \
    --cc=akpm@linux-foundation.org \
    --cc=bp@alien8.de \
    --cc=brgerst@gmail.com \
    --cc=cl@linux.com \
    --cc=dvlasenk@redhat.com \
    --cc=efault@gmx.de \
    --cc=hpa@zytor.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=jpoimboe@redhat.com \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@01.org \
    --cc=luto@kernel.org \
    --cc=mingo@kernel.org \
    --cc=penberg@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rientjes@google.com \
    --cc=torvalds@linux-foundation.org \
    --cc=xiaolong.ye@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.