All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Tony Luck <tony.luck@intel.com>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Helge Deller <deller@gmx.de>,
	linux-parisc@vger.kernel.org, linux-ia64@vger.kernel.org,
	Fengguang Wu <fengguang.wu@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] debug: Do not permit CONFIG_DEBUG_STACK_USAGE=y on IA64 or PARISC
Date: Thu, 26 Jul 2012 12:01:22 +0000	[thread overview]
Message-ID: <20120726120122.GA24672@gmail.com> (raw)
In-Reply-To: <1343203348.3139.16.camel@dabdike>


* James Bottomley <James.Bottomley@HansenPartnership.com> wrote:

> On Wed, 2012-07-25 at 09:45 +0200, Ingo Molnar wrote:
> > * Tony Luck <tony.luck@intel.com> wrote:
> > 
> > > The stack_not_used() function in <linux/sched.h> assumes that stacks
> > > grow downwards. This is not true on IA64 or PARISC, so this function
> > > would walk off in the wrong direction and into the weeds.
> > > 
> > > Found on IA64 because of a compilation failure with recursive dependencies
> > > on IA64_TASKSIZE and IA64_THREAD_INFO_SIZE.
> > > 
> > > Fixing the code is possible, but should be combined with other
> > > infrastructure additions to set up the "canary" at the end of the stack.
> > > 
> > > Reported-by: Fengguang Wu <fengguang.wu@intel.com> (failed allmodconfig build)
> > > Signed-off-by: Tony Luck <tony.luck@intel.com>
> > > ---
> > >  lib/Kconfig.debug | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> > > index ff5bdee..4a18650 100644
> > > --- a/lib/Kconfig.debug
> > > +++ b/lib/Kconfig.debug
> > > @@ -714,7 +714,7 @@ config STACKTRACE
> > >  
> > >  config DEBUG_STACK_USAGE
> > >  	bool "Stack utilization instrumentation"
> > > -	depends on DEBUG_KERNEL
> > > +	depends on DEBUG_KERNEL && !IA64 && !PARISC
> > 
> > The modern way of doing this is by adding an ARCH_SUPPORTS_ 
> > flag.
> 
> That's a bit daft, isn't it? [...]

It's generally more maintainable than a random list of 
architecture exclusions because every (old or new) architecture 
can just grep for ARCH_SUPPORTS_ pattern and see whether they 
support everything that others support.

The above exclusion list of architectures is much harder to find 
in a structured way.

> [...]  We'd have to add ARCH_SUPPORTS_ flags to about 25 
> separate architectures just to get it not supported on these 
> two.

That is one off overhead and it makes things easier to maintain 
going forward.

Anyway, that's the current upstream technique and it's been in 
place for years.

> Since the problem is an invalid assumption about how the stack 
> grows, why not just condition it on that.  We actually have a 
> config option for this: CONFIG_STACK_GROWSUP.  But for some 
> reason ia64 doesn't define this, why not, Tony?  It looks 
> deliberate because you have replaced a lot of
> 
> #ifdef CONFIG_STACK_GROWSUP
> 
> with
> 
> #if defined(CONFIG_STACK_GROWSUP) || defined(CONFIG_IA64)
> 
> but not all of them.

Yes, that's another possible solution, assuming that it's really 
only about the up/down difference.

Thanks,

	Ingo

WARNING: multiple messages have this Message-ID (diff)
From: Ingo Molnar <mingo@kernel.org>
To: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Tony Luck <tony.luck@intel.com>,
	linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
	Helge Deller <deller@gmx.de>,
	linux-parisc@vger.kernel.org, linux-ia64@vger.kernel.org,
	Fengguang Wu <fengguang.wu@intel.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] debug: Do not permit CONFIG_DEBUG_STACK_USAGE=y on IA64 or PARISC
Date: Thu, 26 Jul 2012 14:01:22 +0200	[thread overview]
Message-ID: <20120726120122.GA24672@gmail.com> (raw)
In-Reply-To: <1343203348.3139.16.camel@dabdike>


* James Bottomley <James.Bottomley@HansenPartnership.com> wrote:

> On Wed, 2012-07-25 at 09:45 +0200, Ingo Molnar wrote:
> > * Tony Luck <tony.luck@intel.com> wrote:
> > 
> > > The stack_not_used() function in <linux/sched.h> assumes that stacks
> > > grow downwards. This is not true on IA64 or PARISC, so this function
> > > would walk off in the wrong direction and into the weeds.
> > > 
> > > Found on IA64 because of a compilation failure with recursive dependencies
> > > on IA64_TASKSIZE and IA64_THREAD_INFO_SIZE.
> > > 
> > > Fixing the code is possible, but should be combined with other
> > > infrastructure additions to set up the "canary" at the end of the stack.
> > > 
> > > Reported-by: Fengguang Wu <fengguang.wu@intel.com> (failed allmodconfig build)
> > > Signed-off-by: Tony Luck <tony.luck@intel.com>
> > > ---
> > >  lib/Kconfig.debug | 2 +-
> > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > 
> > > diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> > > index ff5bdee..4a18650 100644
> > > --- a/lib/Kconfig.debug
> > > +++ b/lib/Kconfig.debug
> > > @@ -714,7 +714,7 @@ config STACKTRACE
> > >  
> > >  config DEBUG_STACK_USAGE
> > >  	bool "Stack utilization instrumentation"
> > > -	depends on DEBUG_KERNEL
> > > +	depends on DEBUG_KERNEL && !IA64 && !PARISC
> > 
> > The modern way of doing this is by adding an ARCH_SUPPORTS_ 
> > flag.
> 
> That's a bit daft, isn't it? [...]

It's generally more maintainable than a random list of 
architecture exclusions because every (old or new) architecture 
can just grep for ARCH_SUPPORTS_ pattern and see whether they 
support everything that others support.

The above exclusion list of architectures is much harder to find 
in a structured way.

> [...]  We'd have to add ARCH_SUPPORTS_ flags to about 25 
> separate architectures just to get it not supported on these 
> two.

That is one off overhead and it makes things easier to maintain 
going forward.

Anyway, that's the current upstream technique and it's been in 
place for years.

> Since the problem is an invalid assumption about how the stack 
> grows, why not just condition it on that.  We actually have a 
> config option for this: CONFIG_STACK_GROWSUP.  But for some 
> reason ia64 doesn't define this, why not, Tony?  It looks 
> deliberate because you have replaced a lot of
> 
> #ifdef CONFIG_STACK_GROWSUP
> 
> with
> 
> #if defined(CONFIG_STACK_GROWSUP) || defined(CONFIG_IA64)
> 
> but not all of them.

Yes, that's another possible solution, assuming that it's really 
only about the up/down difference.

Thanks,

	Ingo

  parent reply	other threads:[~2012-07-26 12:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-18 17:35 [PATCH] debug: Do not permit CONFIG_DEBUG_STACK_USAGE=y on IA64 or PARISC Tony Luck
2012-07-18 17:35 ` Tony Luck
2012-07-25  7:45 ` Ingo Molnar
2012-07-25  7:45   ` Ingo Molnar
2012-07-25  8:02   ` James Bottomley
2012-07-25  8:02     ` James Bottomley
2012-07-25 18:23     ` Luck, Tony
2012-07-25 18:23       ` Luck, Tony
2012-07-26 12:01     ` Ingo Molnar [this message]
2012-07-26 12:01       ` Ingo Molnar
2012-07-26 22:17       ` Peter Chubb
2012-07-26 22:17         ` Peter Chubb
2012-07-28  8:12 ` James Bottomley
2012-07-28  8:12   ` James Bottomley
2012-07-28 21:43   ` Luck, Tony
2012-07-28 21:43     ` Luck, Tony

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=20120726120122.GA24672@gmail.com \
    --to=mingo@kernel.org \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=akpm@linux-foundation.org \
    --cc=deller@gmx.de \
    --cc=fengguang.wu@intel.com \
    --cc=linux-ia64@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parisc@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=tony.luck@intel.com \
    --cc=torvalds@linux-foundation.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 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.