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

From: John Ogness
Date: Mon Aug 28 2023 - 04:57:43 EST


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.

John Ogness

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