* [PATCH] connector: Change the judgment conditions for clearing proc_event_num_listeners @ 2024-01-15 7:51 wangkeqi 2024-01-15 7:57 ` Yin, Fengwei 0 siblings, 1 reply; 4+ messages in thread From: wangkeqi @ 2024-01-15 7:51 UTC (permalink / raw) To: davem, edumazet, kuba, pabeni; +Cc: netdev, linux-kernel, fengwei.yin, wangkeqi From: wangkeqi <wangkeqiwang@didiglobal.com> It is inaccurate to judge whether proc_event_num_listeners is cleared by cn_netlink_send_mult returning -ESRCH. In the case of stress-ng netlink-proc, -ESRCH will always be returned, because netlink_broadcast_filtered will return -ESRCH, which may cause stress-ng netlink-proc performance degradation. Therefore, the judgment condition is modified to whether there is a listener. Signed-off-by: wangkeqi <wangkeqiwang@didiglobal.com> --- drivers/connector/cn_proc.c | 6 ++++-- drivers/connector/connector.c | 6 ++++++ include/linux/connector.h | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c index 3d5e6d705..b09f74ed3 100644 --- a/drivers/connector/cn_proc.c +++ b/drivers/connector/cn_proc.c @@ -108,8 +108,10 @@ static inline void send_msg(struct cn_msg *msg) filter_data[1] = 0; } - if (cn_netlink_send_mult(msg, msg->len, 0, CN_IDX_PROC, GFP_NOWAIT, - cn_filter, (void *)filter_data) == -ESRCH) + if (netlink_has_listeners(get_cdev_nls(), CN_IDX_PROC)) + cn_netlink_send_mult(msg, msg->len, 0, CN_IDX_PROC, GFP_NOWAIT, + cn_filter, (void *)filter_data); + else atomic_set(&proc_event_num_listeners, 0); local_unlock(&local_event.lock); diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c index 7f7b94f61..1b2cd410e 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c @@ -129,6 +129,12 @@ int cn_netlink_send(struct cn_msg *msg, u32 portid, u32 __group, } EXPORT_SYMBOL_GPL(cn_netlink_send); +struct sock *get_cdev_nls(void) +{ + return cdev.nls; +} +EXPORT_SYMBOL_GPL(get_cdev_nls); + /* * Callback helper - queues work and setup destructor for given data. */ diff --git a/include/linux/connector.h b/include/linux/connector.h index cec2d99ae..255466aea 100644 --- a/include/linux/connector.h +++ b/include/linux/connector.h @@ -127,6 +127,7 @@ int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid, */ int cn_netlink_send(struct cn_msg *msg, u32 portid, u32 group, gfp_t gfp_mask); +struct sock *get_cdev_nls(void); int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, const struct cb_id *id, void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); -- 2.27.0 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] connector: Change the judgment conditions for clearing proc_event_num_listeners 2024-01-15 7:51 [PATCH] connector: Change the judgment conditions for clearing proc_event_num_listeners wangkeqi @ 2024-01-15 7:57 ` Yin, Fengwei 2024-01-15 9:26 ` wangkeqi 0 siblings, 1 reply; 4+ messages in thread From: Yin, Fengwei @ 2024-01-15 7:57 UTC (permalink / raw) To: wangkeqi, davem, edumazet, kuba, pabeni; +Cc: netdev, linux-kernel, wangkeqi On 1/15/2024 3:51 PM, wangkeqi wrote: > From: wangkeqi <wangkeqiwang@didiglobal.com> > > It is inaccurate to judge whether proc_event_num_listeners is > cleared by cn_netlink_send_mult returning -ESRCH. > In the case of stress-ng netlink-proc, -ESRCH will always be returned, > because netlink_broadcast_filtered will return -ESRCH, > which may cause stress-ng netlink-proc performance degradation. > Therefore, the judgment condition is modified to whether > there is a listener. > > Signed-off-by: wangkeqi <wangkeqiwang@didiglobal.com> Regarding the original report: If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <oliver.sang@intel.com> | Closes: https://lore.kernel.org/oe-lkp/202401112259.b23a1567-oliver.sang@intel.com Could you please add the tag? Thanks. > --- > drivers/connector/cn_proc.c | 6 ++++-- > drivers/connector/connector.c | 6 ++++++ > include/linux/connector.h | 1 + > 3 files changed, 11 insertions(+), 2 deletions(-) > > diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c > index 3d5e6d705..b09f74ed3 100644 > --- a/drivers/connector/cn_proc.c > +++ b/drivers/connector/cn_proc.c > @@ -108,8 +108,10 @@ static inline void send_msg(struct cn_msg *msg) > filter_data[1] = 0; > } > > - if (cn_netlink_send_mult(msg, msg->len, 0, CN_IDX_PROC, GFP_NOWAIT, > - cn_filter, (void *)filter_data) == -ESRCH) > + if (netlink_has_listeners(get_cdev_nls(), CN_IDX_PROC)) > + cn_netlink_send_mult(msg, msg->len, 0, CN_IDX_PROC, GFP_NOWAIT, > + cn_filter, (void *)filter_data); > + else > atomic_set(&proc_event_num_listeners, 0); > > local_unlock(&local_event.lock); > diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c > index 7f7b94f61..1b2cd410e 100644 > --- a/drivers/connector/connector.c > +++ b/drivers/connector/connector.c > @@ -129,6 +129,12 @@ int cn_netlink_send(struct cn_msg *msg, u32 portid, u32 __group, > } > EXPORT_SYMBOL_GPL(cn_netlink_send); > > +struct sock *get_cdev_nls(void) > +{ > + return cdev.nls; > +} > +EXPORT_SYMBOL_GPL(get_cdev_nls); > + > /* > * Callback helper - queues work and setup destructor for given data. > */ > diff --git a/include/linux/connector.h b/include/linux/connector.h > index cec2d99ae..255466aea 100644 > --- a/include/linux/connector.h > +++ b/include/linux/connector.h > @@ -127,6 +127,7 @@ int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid, > */ > int cn_netlink_send(struct cn_msg *msg, u32 portid, u32 group, gfp_t gfp_mask); > > +struct sock *get_cdev_nls(void); > int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, > const struct cb_id *id, > void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re:Re: [PATCH] connector: Change the judgment conditions for clearing proc_event_num_listeners 2024-01-15 7:57 ` Yin, Fengwei @ 2024-01-15 9:26 ` wangkeqi 2024-01-15 23:59 ` Jakub Kicinski 0 siblings, 1 reply; 4+ messages in thread From: wangkeqi @ 2024-01-15 9:26 UTC (permalink / raw) To: Yin, Fengwei Cc: davem, edumazet, kuba, pabeni, netdev, linux-kernel, wangkeqi From: wangkeqi <wangkeqiwang@didiglobal.com> It is inaccurate to judge whether proc_event_num_listeners is cleared by cn_netlink_send_mult returning -ESRCH. In the case of stress-ng netlink-proc, -ESRCH will always be returned, because netlink_broadcast_filtered will return -ESRCH, which may cause stress-ng netlink-proc performance degradation. Therefore, the judgment condition is modified to whether there is a listener. Reported-by: kernel test robot <oliver.sang@intel.com> Closes: https://lore.kernel.org/oe-lkp/202401112259.b23a1567-oliver.sang@intel.com Signed-off-by: wangkeqi <wangkeqiwang@didiglobal.com> Cc: fengwei.yin@intel.com --- drivers/connector/cn_proc.c | 6 ++++-- drivers/connector/connector.c | 6 ++++++ include/linux/connector.h | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c index 3d5e6d705..b09f74ed3 100644 --- a/drivers/connector/cn_proc.c +++ b/drivers/connector/cn_proc.c @@ -108,8 +108,10 @@ static inline void send_msg(struct cn_msg *msg) filter_data[1] = 0; } - if (cn_netlink_send_mult(msg, msg->len, 0, CN_IDX_PROC, GFP_NOWAIT, - cn_filter, (void *)filter_data) == -ESRCH) + if (netlink_has_listeners(get_cdev_nls(), CN_IDX_PROC)) + cn_netlink_send_mult(msg, msg->len, 0, CN_IDX_PROC, GFP_NOWAIT, + cn_filter, (void *)filter_data); + else atomic_set(&proc_event_num_listeners, 0); local_unlock(&local_event.lock); diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c index 7f7b94f61..1b2cd410e 100644 --- a/drivers/connector/connector.c +++ b/drivers/connector/connector.c @@ -129,6 +129,12 @@ int cn_netlink_send(struct cn_msg *msg, u32 portid, u32 __group, } EXPORT_SYMBOL_GPL(cn_netlink_send); +struct sock *get_cdev_nls(void) +{ + return cdev.nls; +} +EXPORT_SYMBOL_GPL(get_cdev_nls); + /* * Callback helper - queues work and setup destructor for given data. */ diff --git a/include/linux/connector.h b/include/linux/connector.h index cec2d99ae..255466aea 100644 --- a/include/linux/connector.h +++ b/include/linux/connector.h @@ -127,6 +127,7 @@ int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid, */ int cn_netlink_send(struct cn_msg *msg, u32 portid, u32 group, gfp_t gfp_mask); +struct sock *get_cdev_nls(void); int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, const struct cb_id *id, void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); -- 2.27.0 The last email is not plain text, I will send it again. At 2024-01-15 15:57:23, "Yin, Fengwei" <fengwei.yin@intel.com> wrote: > > >On 1/15/2024 3:51 PM, wangkeqi wrote: >> From: wangkeqi <wangkeqiwang@didiglobal.com> >> >> It is inaccurate to judge whether proc_event_num_listeners is >> cleared by cn_netlink_send_mult returning -ESRCH. >> In the case of stress-ng netlink-proc, -ESRCH will always be returned, >> because netlink_broadcast_filtered will return -ESRCH, >> which may cause stress-ng netlink-proc performance degradation. >> Therefore, the judgment condition is modified to whether >> there is a listener. >> >> Signed-off-by: wangkeqi <wangkeqiwang@didiglobal.com> > >Regarding the original report: > >If you fix the issue in a separate patch/commit (i.e. not just a new >version of >the same patch/commit), kindly add following tags >| Reported-by: kernel test robot <oliver.sang@intel.com> >| Closes: >https://lore.kernel.org/oe-lkp/202401112259.b23a1567-oliver.sang@intel.com > > >Could you please add the tag? Thanks. > >> --- >> drivers/connector/cn_proc.c | 6 ++++-- >> drivers/connector/connector.c | 6 ++++++ >> include/linux/connector.h | 1 + >> 3 files changed, 11 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c >> index 3d5e6d705..b09f74ed3 100644 >> --- a/drivers/connector/cn_proc.c >> +++ b/drivers/connector/cn_proc.c >> @@ -108,8 +108,10 @@ static inline void send_msg(struct cn_msg *msg) >> filter_data[1] = 0; >> } >> >> - if (cn_netlink_send_mult(msg, msg->len, 0, CN_IDX_PROC, GFP_NOWAIT, >> - cn_filter, (void *)filter_data) == -ESRCH) >> + if (netlink_has_listeners(get_cdev_nls(), CN_IDX_PROC)) >> + cn_netlink_send_mult(msg, msg->len, 0, CN_IDX_PROC, GFP_NOWAIT, >> + cn_filter, (void *)filter_data); >> + else >> atomic_set(&proc_event_num_listeners, 0); >> >> local_unlock(&local_event.lock); >> diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c >> index 7f7b94f61..1b2cd410e 100644 >> --- a/drivers/connector/connector.c >> +++ b/drivers/connector/connector.c >> @@ -129,6 +129,12 @@ int cn_netlink_send(struct cn_msg *msg, u32 portid, u32 __group, >> } >> EXPORT_SYMBOL_GPL(cn_netlink_send); >> >> +struct sock *get_cdev_nls(void) >> +{ >> + return cdev.nls; >> +} >> +EXPORT_SYMBOL_GPL(get_cdev_nls); >> + >> /* >> * Callback helper - queues work and setup destructor for given data. >> */ >> diff --git a/include/linux/connector.h b/include/linux/connector.h >> index cec2d99ae..255466aea 100644 >> --- a/include/linux/connector.h >> +++ b/include/linux/connector.h >> @@ -127,6 +127,7 @@ int cn_netlink_send_mult(struct cn_msg *msg, u16 len, u32 portid, >> */ >> int cn_netlink_send(struct cn_msg *msg, u32 portid, u32 group, gfp_t gfp_mask); >> >> +struct sock *get_cdev_nls(void); >> int cn_queue_add_callback(struct cn_queue_dev *dev, const char *name, >> const struct cb_id *id, >> void (*callback)(struct cn_msg *, struct netlink_skb_parms *)); ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] connector: Change the judgment conditions for clearing proc_event_num_listeners 2024-01-15 9:26 ` wangkeqi @ 2024-01-15 23:59 ` Jakub Kicinski 0 siblings, 0 replies; 4+ messages in thread From: Jakub Kicinski @ 2024-01-15 23:59 UTC (permalink / raw) To: wangkeqi Cc: Yin, Fengwei, davem, edumazet, pabeni, netdev, linux-kernel, wangkeqi On Mon, 15 Jan 2024 17:26:39 +0800 (CST) wangkeqi wrote: > From: wangkeqi <wangkeqiwang@didiglobal.com> > > It is inaccurate to judge whether proc_event_num_listeners is > cleared by cn_netlink_send_mult returning -ESRCH. > In the case of stress-ng netlink-proc, -ESRCH will always be returned, > because netlink_broadcast_filtered will return -ESRCH, > which may cause stress-ng netlink-proc performance degradation. > Therefore, the judgment condition is modified to whether > there is a listener. > > Reported-by: kernel test robot <oliver.sang@intel.com> > Closes: https://lore.kernel.org/oe-lkp/202401112259.b23a1567-oliver.sang@intel.com > Signed-off-by: wangkeqi <wangkeqiwang@didiglobal.com> > Cc: fengwei.yin@intel.com Please stop posting the patches as a reply to the previous submission with a quote at the end.. Post the new version generated by git with --subject-prefix="PATCH net v2" and send it with git send-email as a new thread. Please add an appropriate Fixes tag. -- pw-bot: cr ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-01-15 23:59 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-01-15 7:51 [PATCH] connector: Change the judgment conditions for clearing proc_event_num_listeners wangkeqi 2024-01-15 7:57 ` Yin, Fengwei 2024-01-15 9:26 ` wangkeqi 2024-01-15 23:59 ` Jakub Kicinski
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).