From: Oleg Nesterov <oleg@redhat.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: 'Josh Poimboeuf' <jpoimboe@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Vernon Lovejoy <vlovejoy@redhat.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] x86/show_trace_log_lvl: ensure stack pointer is aligned, again
Date: Sun, 30 Apr 2023 21:00:16 +0200 [thread overview]
Message-ID: <20230430190016.GB606@redhat.com> (raw)
In-Reply-To: <aa8537d81dc747a097e9e30491b5081b@AcuMS.aculab.com>
On 04/30, David Laight wrote:
>
> From: Josh Poimboeuf
> > Sent: 29 April 2023 00:58
> >
> > On Fri, Apr 28, 2023 at 08:55:13AM +0200, Oleg Nesterov wrote:
> > > On 04/27, Josh Poimboeuf wrote:
> > > >
> > > > On Thu, Apr 27, 2023 at 04:00:54PM +0200, Oleg Nesterov wrote:
> > > > > + stack = PTR_ALIGN(stack, sizeof(long));
> > > > > for ( ; stack; stack = PTR_ALIGN(stack_info.next_sp, sizeof(long))) {
> > > > > const char *stack_name;
> > > >
> > > > Seems reasonable, though 'stack' is already initialized a few lines
> > > > above this, so it would be cleaner to do the PTR_ALIGN then. Or even
> > > > better, just move it all to the for loop:
> > > >
> > > > for (stack = PTR_ALIGN(stack ? : get_stack_pointer(task, regs));
> > > > stack;
> > > > stack = PTR_ALIGN(stack_info.next_sp, sizeof(long))) {
> > >
> > > We decided to make the simplest one-liner fix, but I was thinking about
> > >
> > > for ( stack = stack ? : get_stack_pointer(task, regs);
> > > (stack = PTR_ALIGN(stack, sizeof(long)));
> > > stack = stack_info.next_sp)
> > > {
> > > ...
> > >
> > > to factout out the annoying PTR_ALIGN(). Will it work for you?
> >
> > I'd rather not, that's a little *too* clever, IMO.
>
> I'd leave the initialisation outside the loop and move
> the PTR_ALIGN() into the loop so that the 'for' fits on one line:
> if (!stack)
> stack = get_stack_pointer(task, regs);
> for (; stack; stack = stack_info.next_sp) {
> const char ...
> stack = PTR_ALIGN(stack, sizeof(long));
Well to me this looks better than V2 I've sent. Although to be honest I'd
prefer the initial one-liner fix, but this doesn't mater.
I am fine either way, I guess Vernon too. So I leave this to you and Josh,
please tell us if we should send V3 or not.
Oleg.
next prev parent reply other threads:[~2023-04-30 19:01 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-27 14:00 [PATCH] x86/show_trace_log_lvl: ensure stack pointer is aligned, again Oleg Nesterov
2023-04-28 4:31 ` Josh Poimboeuf
2023-04-28 6:55 ` Oleg Nesterov
2023-04-28 23:57 ` Josh Poimboeuf
2023-04-29 10:08 ` Oleg Nesterov
2023-04-30 11:59 ` David Laight
2023-04-30 19:00 ` Oleg Nesterov [this message]
2023-05-12 2:20 ` Josh Poimboeuf
2023-05-12 10:43 ` Oleg Nesterov
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=20230430190016.GB606@redhat.com \
--to=oleg@redhat.com \
--cc=David.Laight@ACULAB.COM \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=vlovejoy@redhat.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