* [PATCH 1/1] RDMA/rxe: Make pr_fmt work
@ 2024-03-23 8:31 Yanjun.Zhu
2024-03-24 11:43 ` Greg Sword
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Yanjun.Zhu @ 2024-03-23 8:31 UTC (permalink / raw)
To: zyjzyj2000, jgg, leon, linux-rdma; +Cc: Zhu Yanjun
From: Zhu Yanjun <yanjun.zhu@linux.dev>
If the definition of pr_fmt is before the header file. The pr_fmt
will be overwritten by the header file. So move the definition of
pr_fmt to the below of the header file.
Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
---
drivers/infiniband/sw/rxe/rxe.h | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/infiniband/sw/rxe/rxe.h b/drivers/infiniband/sw/rxe/rxe.h
index d8fb2c7af30a..dc2d8dd2f681 100644
--- a/drivers/infiniband/sw/rxe/rxe.h
+++ b/drivers/infiniband/sw/rxe/rxe.h
@@ -7,11 +7,6 @@
#ifndef RXE_H
#define RXE_H
-#ifdef pr_fmt
-#undef pr_fmt
-#endif
-#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-
#include <linux/skbuff.h>
#include <rdma/ib_verbs.h>
@@ -30,6 +25,11 @@
#include "rxe_verbs.h"
#include "rxe_loc.h"
+#ifdef pr_fmt
+#undef pr_fmt
+#endif
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
/*
* Version 1 and Version 2 are identical on 64 bit machines, but on 32 bit
* machines Version 2 has a different struct layout.
--
2.34.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 1/1] RDMA/rxe: Make pr_fmt work
2024-03-23 8:31 [PATCH 1/1] RDMA/rxe: Make pr_fmt work Yanjun.Zhu
@ 2024-03-24 11:43 ` Greg Sword
2024-03-27 13:08 ` Jason Gunthorpe
2024-04-02 17:45 ` Leon Romanovsky
2 siblings, 0 replies; 11+ messages in thread
From: Greg Sword @ 2024-03-24 11:43 UTC (permalink / raw)
To: Yanjun.Zhu; +Cc: zyjzyj2000, jgg, leon, linux-rdma
On Sat, Mar 23, 2024 at 4:32 PM Yanjun.Zhu <yanjun.zhu@linux.dev> wrote:
>
> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>
> If the definition of pr_fmt is before the header file. The pr_fmt
> will be overwritten by the header file. So move the definition of
> pr_fmt to the below of the header file.
Awesome. You fix my problem.
>
> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
> ---
> drivers/infiniband/sw/rxe/rxe.h | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/infiniband/sw/rxe/rxe.h b/drivers/infiniband/sw/rxe/rxe.h
> index d8fb2c7af30a..dc2d8dd2f681 100644
> --- a/drivers/infiniband/sw/rxe/rxe.h
> +++ b/drivers/infiniband/sw/rxe/rxe.h
> @@ -7,11 +7,6 @@
> #ifndef RXE_H
> #define RXE_H
>
> -#ifdef pr_fmt
> -#undef pr_fmt
> -#endif
> -#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> -
> #include <linux/skbuff.h>
>
> #include <rdma/ib_verbs.h>
> @@ -30,6 +25,11 @@
> #include "rxe_verbs.h"
> #include "rxe_loc.h"
>
> +#ifdef pr_fmt
> +#undef pr_fmt
> +#endif
> +#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
> +
> /*
> * Version 1 and Version 2 are identical on 64 bit machines, but on 32 bit
> * machines Version 2 has a different struct layout.
> --
> 2.34.1
>
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/1] RDMA/rxe: Make pr_fmt work
2024-03-23 8:31 [PATCH 1/1] RDMA/rxe: Make pr_fmt work Yanjun.Zhu
2024-03-24 11:43 ` Greg Sword
@ 2024-03-27 13:08 ` Jason Gunthorpe
2024-03-27 19:40 ` Zhu Yanjun
2024-04-02 17:45 ` Leon Romanovsky
2 siblings, 1 reply; 11+ messages in thread
From: Jason Gunthorpe @ 2024-03-27 13:08 UTC (permalink / raw)
To: Yanjun.Zhu; +Cc: zyjzyj2000, leon, linux-rdma
On Sat, Mar 23, 2024 at 09:31:39AM +0100, Yanjun.Zhu wrote:
> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>
> If the definition of pr_fmt is before the header file. The pr_fmt
> will be overwritten by the header file. So move the definition of
> pr_fmt to the below of the header file.
what header file?
Jason
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/1] RDMA/rxe: Make pr_fmt work
2024-03-27 13:08 ` Jason Gunthorpe
@ 2024-03-27 19:40 ` Zhu Yanjun
2024-04-04 14:59 ` Jason Gunthorpe
0 siblings, 1 reply; 11+ messages in thread
From: Zhu Yanjun @ 2024-03-27 19:40 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: zyjzyj2000, leon, linux-rdma
在 2024/3/27 14:08, Jason Gunthorpe 写道:
> On Sat, Mar 23, 2024 at 09:31:39AM +0100, Yanjun.Zhu wrote:
>> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>>
>> If the definition of pr_fmt is before the header file. The pr_fmt
>> will be overwritten by the header file. So move the definition of
>> pr_fmt to the below of the header file.
> what header file?
include/linux/printk.h
Because this driver will finally call printk function to output the
logs, the header file include/linux/printk.h needs be included.
In include/linux/printk.h, pr_fmt is defined.
I made a simple checks. In about 130 header files, this pr_fmt is defined.
Zhu Yanjun
>
> Jason
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/1] RDMA/rxe: Make pr_fmt work
2024-03-23 8:31 [PATCH 1/1] RDMA/rxe: Make pr_fmt work Yanjun.Zhu
2024-03-24 11:43 ` Greg Sword
2024-03-27 13:08 ` Jason Gunthorpe
@ 2024-04-02 17:45 ` Leon Romanovsky
2024-04-03 16:46 ` Zhu Yanjun
2 siblings, 1 reply; 11+ messages in thread
From: Leon Romanovsky @ 2024-04-02 17:45 UTC (permalink / raw)
To: Yanjun.Zhu; +Cc: zyjzyj2000, jgg, linux-rdma
On Sat, Mar 23, 2024 at 09:31:39AM +0100, Yanjun.Zhu wrote:
> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>
> If the definition of pr_fmt is before the header file. The pr_fmt
> will be overwritten by the header file. So move the definition of
> pr_fmt to the below of the header file.
>
> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
> ---
> drivers/infiniband/sw/rxe/rxe.h | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
Let's just convert RXE to ibdev*() prints instead.
Thanks
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/1] RDMA/rxe: Make pr_fmt work
2024-04-02 17:45 ` Leon Romanovsky
@ 2024-04-03 16:46 ` Zhu Yanjun
0 siblings, 0 replies; 11+ messages in thread
From: Zhu Yanjun @ 2024-04-03 16:46 UTC (permalink / raw)
To: Leon Romanovsky; +Cc: zyjzyj2000, jgg, linux-rdma
在 2024/4/2 19:45, Leon Romanovsky 写道:
> On Sat, Mar 23, 2024 at 09:31:39AM +0100, Yanjun.Zhu wrote:
>> From: Zhu Yanjun <yanjun.zhu@linux.dev>
>>
>> If the definition of pr_fmt is before the header file. The pr_fmt
>> will be overwritten by the header file. So move the definition of
>> pr_fmt to the below of the header file.
>>
>> Signed-off-by: Zhu Yanjun <yanjun.zhu@linux.dev>
>> ---
>> drivers/infiniband/sw/rxe/rxe.h | 10 +++++-----
>> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> Let's just convert RXE to ibdev*() prints instead.
OK. I will do. But it takes me some time because it seems a big task.^_^
Zhu Yanjun
>
> Thanks
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/1] RDMA/rxe: Make pr_fmt work
2024-03-27 19:40 ` Zhu Yanjun
@ 2024-04-04 14:59 ` Jason Gunthorpe
[not found] ` <7a2a41c2-c8ef-402d-933a-2b2d8a956207@linux.dev>
0 siblings, 1 reply; 11+ messages in thread
From: Jason Gunthorpe @ 2024-04-04 14:59 UTC (permalink / raw)
To: Zhu Yanjun; +Cc: zyjzyj2000, leon, linux-rdma
On Wed, Mar 27, 2024 at 08:40:54PM +0100, Zhu Yanjun wrote:
>
> 在 2024/3/27 14:08, Jason Gunthorpe 写道:
> > On Sat, Mar 23, 2024 at 09:31:39AM +0100, Yanjun.Zhu wrote:
> > > From: Zhu Yanjun <yanjun.zhu@linux.dev>
> > >
> > > If the definition of pr_fmt is before the header file. The pr_fmt
> > > will be overwritten by the header file. So move the definition of
> > > pr_fmt to the below of the header file.
> > what header file?
>
> include/linux/printk.h
>
> Because this driver will finally call printk function to output the logs,
> the header file include/linux/printk.h needs be included.
>
> In include/linux/printk.h, pr_fmt is defined.
This doesn't make sense, printk.h has:
#ifndef pr_fmt
#define pr_fmt(fmt) fmt
#endif
Before or after printk.h should not have an impact.
Jason
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/1] RDMA/rxe: Make pr_fmt work
[not found] ` <7a2a41c2-c8ef-402d-933a-2b2d8a956207@linux.dev>
@ 2024-04-04 18:03 ` Zhu Yanjun
2024-04-04 23:59 ` Jason Gunthorpe
0 siblings, 1 reply; 11+ messages in thread
From: Zhu Yanjun @ 2024-04-04 18:03 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: zyjzyj2000, leon, linux-rdma
在 2024/4/4 20:01, Zhu Yanjun 写道:
>
>
> 在 2024/4/4 16:59, Jason Gunthorpe 写道:
>> On Wed, Mar 27, 2024 at 08:40:54PM +0100, Zhu Yanjun wrote:
>>> 在 2024/3/27 14:08, Jason Gunthorpe 写道:
>>>> On Sat, Mar 23, 2024 at 09:31:39AM +0100, Yanjun.Zhu wrote:
>>>>> From: Zhu Yanjun<yanjun.zhu@linux.dev>
>>>>>
>>>>> If the definition of pr_fmt is before the header file. The pr_fmt
>>>>> will be overwritten by the header file. So move the definition of
>>>>> pr_fmt to the below of the header file.
>>>> what header file?
>>> include/linux/printk.h
>>>
>>> Because this driver will finally call printk function to output the logs,
>>> the header file include/linux/printk.h needs be included.
>>>
>>> In include/linux/printk.h, pr_fmt is defined.
>> This doesn't make sense, printk.h has:
>>
>> #ifndef pr_fmt
>> #define pr_fmt(fmt) fmt
>> #endif
>>
>> Before or after printk.h should not have an impact.
Sorry. The previous mail is not sent successfully. I resend it.
> #ifndef pr_fmt
>
> ...
>
> #endif
>
> The above will not undefine pr_fmt.
>
> #undef pr_fmt will undefine pr_fmt.
>
> This link explains the above in details.
>
https://www.techonthenet.com/c_language/directives/ifndef.php
>
> Thanks a lot for your comments.
>
> Zhu Yanjun
>
>> Jason
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/1] RDMA/rxe: Make pr_fmt work
2024-04-04 18:03 ` Zhu Yanjun
@ 2024-04-04 23:59 ` Jason Gunthorpe
2024-04-06 16:35 ` Zhu Yanjun
0 siblings, 1 reply; 11+ messages in thread
From: Jason Gunthorpe @ 2024-04-04 23:59 UTC (permalink / raw)
To: Zhu Yanjun; +Cc: zyjzyj2000, leon, linux-rdma
On Thu, Apr 04, 2024 at 08:03:35PM +0200, Zhu Yanjun wrote:
> > > > Because this driver will finally call printk function to output the logs,
> > > > the header file include/linux/printk.h needs be included.
> > > >
> > > > In include/linux/printk.h, pr_fmt is defined.
> > > This doesn't make sense, printk.h has:
> > >
> > > #ifndef pr_fmt
> > > #define pr_fmt(fmt) fmt
> > > #endif
> > >
> > > Before or after printk.h should not have an impact.
>
>
> Sorry. The previous mail is not sent successfully. I resend it.
>
> > #ifndef pr_fmt
> >
> > ...
> >
> > #endif
> >
> > The above will not undefine pr_fmt.
> >
> > #undef pr_fmt will undefine pr_fmt.
> >
> > This link explains the above in details.
> >
> https://www.techonthenet.com/c_language/directives/ifndef.php
Why would you want to undefine it? The point is to #define it to the
rxe specific value. If it is already set to the rxe specific value
before including printk.h then it will work fine?
Jason
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/1] RDMA/rxe: Make pr_fmt work
2024-04-04 23:59 ` Jason Gunthorpe
@ 2024-04-06 16:35 ` Zhu Yanjun
2024-04-08 14:08 ` Jason Gunthorpe
0 siblings, 1 reply; 11+ messages in thread
From: Zhu Yanjun @ 2024-04-06 16:35 UTC (permalink / raw)
To: Jason Gunthorpe; +Cc: zyjzyj2000, leon, linux-rdma
在 2024/4/5 1:59, Jason Gunthorpe 写道:
> On Thu, Apr 04, 2024 at 08:03:35PM +0200, Zhu Yanjun wrote:
>>>>> Because this driver will finally call printk function to output the logs,
>>>>> the header file include/linux/printk.h needs be included.
>>>>>
>>>>> In include/linux/printk.h, pr_fmt is defined.
>>>> This doesn't make sense, printk.h has:
>>>>
>>>> #ifndef pr_fmt
>>>> #define pr_fmt(fmt) fmt
>>>> #endif
>>>>
>>>> Before or after printk.h should not have an impact.
>>
>>
>> Sorry. The previous mail is not sent successfully. I resend it.
>>
>>> #ifndef pr_fmt
>>>
>>> ...
>>>
>>> #endif
>>>
>>> The above will not undefine pr_fmt.
>>>
>>> #undef pr_fmt will undefine pr_fmt.
>>>
>>> This link explains the above in details.
>>>
>> https://www.techonthenet.com/c_language/directives/ifndef.php
>
> Why would you want to undefine it? The point is to #define it to the
> rxe specific value. If it is already set to the rxe specific value
> before including printk.h then it will work fine?
Got your point. There are about more 130 header files that define pr_fmt
in the kernel include directory. And these header files are included one
another. Is there any tool to clarify the including relationship between
these header files?
Thanks a lot
Zhu Yanjun
>
> Jason
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH 1/1] RDMA/rxe: Make pr_fmt work
2024-04-06 16:35 ` Zhu Yanjun
@ 2024-04-08 14:08 ` Jason Gunthorpe
0 siblings, 0 replies; 11+ messages in thread
From: Jason Gunthorpe @ 2024-04-08 14:08 UTC (permalink / raw)
To: Zhu Yanjun; +Cc: zyjzyj2000, leon, linux-rdma
On Sat, Apr 06, 2024 at 06:35:21PM +0200, Zhu Yanjun wrote:
> Got your point. There are about more 130 header files that define pr_fmt in
> the kernel include directory. And these header files are included one
> another. Is there any tool to clarify the including relationship between
> these header files?
No tool I am aware of, but if headers define it then they should be
local to a subsystem and never included outside it. Such as what rxe
is doing.
Ideally they would be private headers not under include/
Jason
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2024-04-08 14:08 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-03-23 8:31 [PATCH 1/1] RDMA/rxe: Make pr_fmt work Yanjun.Zhu
2024-03-24 11:43 ` Greg Sword
2024-03-27 13:08 ` Jason Gunthorpe
2024-03-27 19:40 ` Zhu Yanjun
2024-04-04 14:59 ` Jason Gunthorpe
[not found] ` <7a2a41c2-c8ef-402d-933a-2b2d8a956207@linux.dev>
2024-04-04 18:03 ` Zhu Yanjun
2024-04-04 23:59 ` Jason Gunthorpe
2024-04-06 16:35 ` Zhu Yanjun
2024-04-08 14:08 ` Jason Gunthorpe
2024-04-02 17:45 ` Leon Romanovsky
2024-04-03 16:46 ` Zhu Yanjun
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox