Re: [PATCH v2 1/2] RDMA/rxe: Improve newline in printing messages

From: Zhu Yanjun
Date: Mon Aug 28 2023 - 06:16:50 EST


On Mon, Aug 28, 2023 at 4:56 PM John Ogness <john.ogness@xxxxxxxxxxxxx> wrote:
>
> Hi Zhu,
>
> On 2023-08-23, Zhu Yanjun <yanjun.zhu@xxxxxxxxx> wrote:
> >> Previously rxe_{dbg,info,err}() macros are appened built-in newline,
> >> sut some users will add redundent newline some times. So remove the
> >> built-int newline for this macros.
> >
> > This commit is based on this statement "A newline help flushing
> > message out.".
> >
> > All the rxe_xxx log functions will finally call printk.
> >
> > To pirntk, there is no such statement in kernel document. Not sure if
> > Jason and Leon can decide this statement correct or not.
>
> I also could not find any documentation explaining the semantics of
> printk with regard to LOG_CONT and "\n". I suppose this should be added
> somewhere.
>
> However, the above statement is correct. You can see this in the code
> [0]. All printk messages should have a trailing newline unless it is
> only a partial message that will be appended.

Thanks a lot.
Do you mean "a newline can help flushing messages out"?
That is, in printk, the message will be buffered until it is full or
it meets a newline?

Zhu Yanjun


>
> John Ogness
>
> [0] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/kernel/printk/printk.c?h=v6.5#n2254