From: David Laight <David.Laight@ACULAB.COM>
To: 'Josh Poimboeuf' <jpoimboe@kernel.org>, Oleg Nesterov <oleg@redhat.com>
Cc: 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 11:59:17 +0000 [thread overview]
Message-ID: <aa8537d81dc747a097e9e30491b5081b@AcuMS.aculab.com> (raw)
In-Reply-To: <20230428235747.b5smutdttv5eeopi@treble>
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));
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2023-04-30 11:59 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-27 14:00 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 [this message]
2023-04-30 19:00 ` Oleg Nesterov
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=aa8537d81dc747a097e9e30491b5081b@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=jpoimboe@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--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
all inboxes | Powered by JetHome®