2019-06-25 04:11:23

by Yue Haibing

[permalink] [raw]
Subject: [PATCH net-next] xdp: Make __mem_id_disconnect static

Fix sparse warning:

net/core/xdp.c:88:6: warning:
symbol '__mem_id_disconnect' was not declared. Should it be static?

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: YueHaibing <[email protected]>
---
net/core/xdp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/core/xdp.c b/net/core/xdp.c
index b29d7b5..829377c 100644
--- a/net/core/xdp.c
+++ b/net/core/xdp.c
@@ -85,7 +85,7 @@ static void __xdp_mem_allocator_rcu_free(struct rcu_head *rcu)
kfree(xa);
}

-bool __mem_id_disconnect(int id, bool force)
+static bool __mem_id_disconnect(int id, bool force)
{
struct xdp_mem_allocator *xa;
bool safe_to_remove = true;
--
2.7.4



2019-06-25 11:53:40

by Jesper Dangaard Brouer

[permalink] [raw]
Subject: Re: [PATCH net-next] xdp: Make __mem_id_disconnect static

On Tue, 25 Jun 2019 10:31:37 +0800
YueHaibing <[email protected]> wrote:

> Fix sparse warning:
>
> net/core/xdp.c:88:6: warning:
> symbol '__mem_id_disconnect' was not declared. Should it be static?

I didn't declare it static as I didn't want it to get inlined. As
during development I was using kprobes to inspect this function. In
the end I added a tracepoint in this function as kprobes was not enough
to capture the state needed.

So, I guess we can declare it static.

Acked-by: Jesper Dangaard Brouer <[email protected]>

> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: YueHaibing <[email protected]>
> ---
> net/core/xdp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/core/xdp.c b/net/core/xdp.c
> index b29d7b5..829377c 100644
> --- a/net/core/xdp.c
> +++ b/net/core/xdp.c
> @@ -85,7 +85,7 @@ static void __xdp_mem_allocator_rcu_free(struct rcu_head *rcu)
> kfree(xa);
> }
>
> -bool __mem_id_disconnect(int id, bool force)
> +static bool __mem_id_disconnect(int id, bool force)
> {
> struct xdp_mem_allocator *xa;
> bool safe_to_remove = true;


--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer

2019-06-25 22:24:11

by Song Liu

[permalink] [raw]
Subject: Re: [PATCH net-next] xdp: Make __mem_id_disconnect static

On Tue, Jun 25, 2019 at 4:52 AM Jesper Dangaard Brouer
<[email protected]> wrote:
>
> On Tue, 25 Jun 2019 10:31:37 +0800
> YueHaibing <[email protected]> wrote:
>
> > Fix sparse warning:
> >
> > net/core/xdp.c:88:6: warning:
> > symbol '__mem_id_disconnect' was not declared. Should it be static?
>
> I didn't declare it static as I didn't want it to get inlined. As
> during development I was using kprobes to inspect this function. In
> the end I added a tracepoint in this function as kprobes was not enough
> to capture the state needed.
>
> So, I guess we can declare it static.
>
> Acked-by: Jesper Dangaard Brouer <[email protected]>

I think the rule is, non-static function must be declared in a header.

Acked-by: Song Liu <[email protected]>

>
> > Reported-by: Hulk Robot <[email protected]>
> > Signed-off-by: YueHaibing <[email protected]>
> > ---
> > net/core/xdp.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/net/core/xdp.c b/net/core/xdp.c
> > index b29d7b5..829377c 100644
> > --- a/net/core/xdp.c
> > +++ b/net/core/xdp.c
> > @@ -85,7 +85,7 @@ static void __xdp_mem_allocator_rcu_free(struct rcu_head *rcu)
> > kfree(xa);
> > }
> >
> > -bool __mem_id_disconnect(int id, bool force)
> > +static bool __mem_id_disconnect(int id, bool force)
> > {
> > struct xdp_mem_allocator *xa;
> > bool safe_to_remove = true;
>
>
> --
> Best regards,
> Jesper Dangaard Brouer
> MSc.CS, Principal Kernel Engineer at Red Hat
> LinkedIn: http://www.linkedin.com/in/brouer

2019-06-26 14:34:01

by Daniel Borkmann

[permalink] [raw]
Subject: Re: [PATCH net-next] xdp: Make __mem_id_disconnect static

On 06/25/2019 04:31 AM, YueHaibing wrote:
> Fix sparse warning:
>
> net/core/xdp.c:88:6: warning:
> symbol '__mem_id_disconnect' was not declared. Should it be static?
>
> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: YueHaibing <[email protected]>

Applied, thanks!