linux-hardening.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Enlin Mu <enlinmu@gmail.com>
Cc: John Ogness <john.ogness@linutronix.de>,
	Enlin Mu <enlin.mu@outlook.com>,
	pmladek@suse.com, rostedt@goodmis.org, senozhatsky@chromium.org,
	keescook@chromium.org, tony.luck@intel.com, gpiccoli@igalia.com,
	enlin.mu@unisoc.com, linux-kernel@vger.kernel.org,
	linux-hardening@vger.kernel.org
Subject: Re: [PATCH] printk: add cpu id information to printk() output
Date: Fri, 15 Sep 2023 11:53:13 +0200	[thread overview]
Message-ID: <2023091547-mug-unlikable-571f@gregkh> (raw)
In-Reply-To: <CAAfh-jPc+UWMcLPFbYy6rYUh4OU36frkVYVbkhNPNX4L6RG5sA@mail.gmail.com>

On Fri, Sep 15, 2023 at 04:46:02PM +0800, Enlin Mu wrote:
> John Ogness <john.ogness@linutronix.de> 于2023年9月15日周五 16:34写道:
> >
> > On 2023-09-15, Enlin Mu <enlin.mu@outlook.com> wrote:
> > > Sometimes we want to print cpu id of printk() messages to consoles
> > >
> > > diff --git a/include/linux/threads.h b/include/linux/threads.h
> > > index c34173e6c5f1..6700bd9a174f 100644
> > > --- a/include/linux/threads.h
> > > +++ b/include/linux/threads.h
> > > @@ -34,6 +34,9 @@
> > >  #define PID_MAX_LIMIT (CONFIG_BASE_SMALL ? PAGE_SIZE * 8 : \
> > >       (sizeof(long) > 4 ? 4 * 1024 * 1024 : PID_MAX_DEFAULT))
> > >
> > > +#define CPU_ID_SHIFT 23
> > > +#define CPU_ID_MASK  0xff800000
> >
> > This only supports 256 CPUs. I think it doesn't make sense to try to
> > squish CPU and Task IDs into 32 bits.
> Yes, it is not good way,
> >
> > What about introducing a caller_id option to always only print the CPU
> > ID? Or do you really need Task _and_ CPU?
>    Yes, I need it.Because I need to know which CPU is printing the
> log, so that I can identify the current system operation, such as load
> situation and CPU busy/idle status

The cpu that is printing the log isn't the one that added the log
message, so I think you will have incorrect data here, right?

thanks,

greg k-h

  reply	other threads:[~2023-09-15  9:54 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-15  7:40 [PATCH] printk: add cpu id information to printk() output Enlin Mu
2023-09-15  8:34 ` John Ogness
2023-09-15  8:46   ` Enlin Mu
2023-09-15  9:53     ` Greg KH [this message]
2023-09-15 16:32       ` Petr Mladek
2023-09-18  8:54         ` John Ogness
2023-09-22  7:20         ` Enlin Mu
2023-09-22  8:03           ` Petr Mladek
2023-09-22  7:34   ` Enlin Mu
2023-09-22  7:47     ` Petr Mladek
2023-09-15  9:51 ` Greg KH
2023-09-15 16:31 ` 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=2023091547-mug-unlikable-571f@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=enlin.mu@outlook.com \
    --cc=enlin.mu@unisoc.com \
    --cc=enlinmu@gmail.com \
    --cc=gpiccoli@igalia.com \
    --cc=john.ogness@linutronix.de \
    --cc=keescook@chromium.org \
    --cc=linux-hardening@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmladek@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=senozhatsky@chromium.org \
    --cc=tony.luck@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).