All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Peter Osterlund <petero2@telia.com>
Cc: Nix <nix@esperi.org.uk>,
	dm-devel@redhat.com, linux-kernel@vger.kernel.org
Subject: Re: 2.6.24.2: 4KSTACKS + pcdrw + dm + mount -> stack overflow: ide-cd related? dm-related?
Date: Mon, 25 Feb 2008 12:25:22 -0800	[thread overview]
Message-ID: <20080225122522.f2a9f073.akpm@linux-foundation.org> (raw)
In-Reply-To: <m363wepa3a.fsf@telia.com>

On Sun, 24 Feb 2008 17:56:09 +0100 Peter Osterlund <petero2@telia.com> wrote:

> 
>  drivers/block/pktcdvd.c |   16 ++++++++--------
>  1 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
> index 674cd66..f2510e7 100644
> --- a/drivers/block/pktcdvd.c
> +++ b/drivers/block/pktcdvd.c
> @@ -849,7 +849,7 @@ static int pkt_flush_cache(struct pktcdvd_device *pd)
>  /*
>   * speed is given as the normal factor, e.g. 4 for 4x
>   */
> -static int pkt_set_speed(struct pktcdvd_device *pd, unsigned write_speed, unsigned read_speed)
> +static noinline int pkt_set_speed(struct pktcdvd_device *pd, unsigned write_speed, unsigned read_speed)
>
> ...

yup, I'll grab that.  I'll even write your changelog for you (grr).

But first, let's do this:


From: Andrew Morton <akpm@linux-foundation.org>

People are adding `noinline' in various places to prevent excess stack
consumption due to gcc inlining.  But once this is done, it is quite unobvious
why the `noinline' is present in the code.  We can comment each and every
site, or we can use noinline_for_stack.


Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/compiler.h |    6 ++++++
 1 file changed, 6 insertions(+)

diff -puN include/linux/compiler.h~add-noinline_for_stack include/linux/compiler.h
--- a/include/linux/compiler.h~add-noinline_for_stack
+++ a/include/linux/compiler.h
@@ -138,6 +138,12 @@ extern void __chk_io_ptr(const volatile 
 #define noinline
 #endif
 
+/*
+ * Rather then using noinline to prevent stack consumption, use
+ * noinline_for_stack instead.  For documentaiton reasons.
+ */
+#define noinline_for_stack noinline
+
 #ifndef __always_inline
 #define __always_inline inline
 #endif
_

(Note that these changes don't let DM off the hook!)

WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Peter Osterlund <petero2@telia.com>
Cc: Nix <nix@esperi.org.uk>,
	linux-kernel@vger.kernel.org, dm-devel@redhat.com
Subject: Re: 2.6.24.2: 4KSTACKS + pcdrw + dm + mount -> stack overflow: ide-cd related? dm-related?
Date: Mon, 25 Feb 2008 12:25:22 -0800	[thread overview]
Message-ID: <20080225122522.f2a9f073.akpm@linux-foundation.org> (raw)
In-Reply-To: <m363wepa3a.fsf@telia.com>

On Sun, 24 Feb 2008 17:56:09 +0100 Peter Osterlund <petero2@telia.com> wrote:

> 
>  drivers/block/pktcdvd.c |   16 ++++++++--------
>  1 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
> index 674cd66..f2510e7 100644
> --- a/drivers/block/pktcdvd.c
> +++ b/drivers/block/pktcdvd.c
> @@ -849,7 +849,7 @@ static int pkt_flush_cache(struct pktcdvd_device *pd)
>  /*
>   * speed is given as the normal factor, e.g. 4 for 4x
>   */
> -static int pkt_set_speed(struct pktcdvd_device *pd, unsigned write_speed, unsigned read_speed)
> +static noinline int pkt_set_speed(struct pktcdvd_device *pd, unsigned write_speed, unsigned read_speed)
>
> ...

yup, I'll grab that.  I'll even write your changelog for you (grr).

But first, let's do this:


From: Andrew Morton <akpm@linux-foundation.org>

People are adding `noinline' in various places to prevent excess stack
consumption due to gcc inlining.  But once this is done, it is quite unobvious
why the `noinline' is present in the code.  We can comment each and every
site, or we can use noinline_for_stack.


Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 include/linux/compiler.h |    6 ++++++
 1 file changed, 6 insertions(+)

diff -puN include/linux/compiler.h~add-noinline_for_stack include/linux/compiler.h
--- a/include/linux/compiler.h~add-noinline_for_stack
+++ a/include/linux/compiler.h
@@ -138,6 +138,12 @@ extern void __chk_io_ptr(const volatile 
 #define noinline
 #endif
 
+/*
+ * Rather then using noinline to prevent stack consumption, use
+ * noinline_for_stack instead.  For documentaiton reasons.
+ */
+#define noinline_for_stack noinline
+
 #ifndef __always_inline
 #define __always_inline inline
 #endif
_

(Note that these changes don't let DM off the hook!)


  parent reply	other threads:[~2008-02-25 20:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-24  1:56 2.6.24.2: 4KSTACKS + PCA403CD IDE CD + pcdrw + mount + PREEMPT -> stack overflow Nix
2008-02-24 15:59 ` 2.6.24.2: 4KSTACKS + pcdrw + dm + mount -> stack overflow: ide-cd related? dm-related? Nix
2008-02-24 16:56   ` Peter Osterlund
2008-02-24 17:02     ` Nix
2008-02-25 20:30       ` Andrew Morton
2008-02-25 20:30         ` Andrew Morton
2008-02-25 22:48         ` Jan Kara
2008-02-25 22:51           ` Andrew Morton
2008-02-25 22:51             ` Andrew Morton
2008-02-26 11:10           ` Jiri Kosina
2008-02-26 11:29             ` Ingo Molnar
2008-02-26 11:29               ` Ingo Molnar
2008-02-26 11:37               ` Jiri Kosina
2008-02-26 16:41                 ` Jan Kara
2008-02-26 17:25             ` Daniel Hazelton
2008-03-06 16:14       ` Jan Kara
2008-03-10 20:09         ` Nix
2008-03-10 20:09           ` Nix
2008-02-25 20:25     ` Andrew Morton [this message]
2008-02-25 20:25       ` Andrew Morton

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=20080225122522.f2a9f073.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=dm-devel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nix@esperi.org.uk \
    --cc=petero2@telia.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.