* Re: [PATCH v2] net: Add trace events for all receive exit points
From: Mathieu Desnoyers @ 2018-11-12 20:56 UTC (permalink / raw)
To: rostedt; +Cc: Geneviève Bastien, David S. Miller, netdev, Ingo Molnar
In-Reply-To: <1354786248.4048.1542055613213.JavaMail.zimbra@efficios.com>
----- On Nov 12, 2018, at 3:46 PM, Mathieu Desnoyers mathieu.desnoyers@efficios.com wrote:
> ----- On Nov 12, 2018, at 3:40 PM, rostedt rostedt@goodmis.org wrote:
>
>> On Mon, 12 Nov 2018 15:20:55 -0500 (EST)
>> Mathieu Desnoyers <mathieu.desnoyers@efficios.com> wrote:
>>
>>>
>>> Hrm, looking at this again, I notice that there is a single DEFINE_EVENT
>>> using net_dev_template_simple.
>>>
>>> We could simply turn netif_receive_skb_list_exit into a TRACE_EVENT(),
>>> remove the net_dev_template_simple, and rename the net_dev_template_return
>>> to net_dev_template ?
>>
>> This too is only cosmetic and doesn't affect the code at all, because a
>> TRACE_EVENT() is really just:
>>
>> #define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
>> DECLARE_EVENT_CLASS(name, \
>> PARAMS(proto), \
>> PARAMS(args), \
>> PARAMS(tstruct), \
>> PARAMS(assign), \
>> PARAMS(print)); \
>> DEFINE_EVENT(name, name, PARAMS(proto), PARAMS(args));
>>
>> -- Steve
>>
>
> Of course.
>
> I also notice that in two cases, a "gro_result_t" is implicitly cast
> to "int". I usually frown upon this kind of stuff, because it's asking
> for trouble if gro_result_t typedef to something else than "int" in the
> future.
>
> I would recommend going for two templates, one which takes a "int"
> ret parameter, and the other a "gro_result_t" ret parameter.
>
> Or am I being too cautious ?
Digging further, gro_result_t maps to:
enum gro_result {
GRO_MERGED,
GRO_MERGED_FREE,
GRO_HELD,
GRO_NORMAL,
GRO_DROP,
GRO_CONSUMED,
};
typedef enum gro_result gro_result_t;
So we should add a TRACE_DEFINE_ENUM() for those.
Thanks,
Mathieu
>
> Thanks,
>
> Mathieu
>
>
>>>
>>> It's pretty clear from the prototype that it expects a "ret" argument,
>>> so I don't see the need to also state it in the template name.
>>>
>
> --
> Mathieu Desnoyers
> EfficiOS Inc.
> http://www.efficios.com
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply
* Re: [PATCH v2] net: Add trace events for all receive exit points
From: Mathieu Desnoyers @ 2018-11-12 20:46 UTC (permalink / raw)
To: rostedt; +Cc: Geneviève Bastien, David S. Miller, netdev, Ingo Molnar
In-Reply-To: <20181112154035.56de5e23@vmware.local.home>
----- On Nov 12, 2018, at 3:40 PM, rostedt rostedt@goodmis.org wrote:
> On Mon, 12 Nov 2018 15:20:55 -0500 (EST)
> Mathieu Desnoyers <mathieu.desnoyers@efficios.com> wrote:
>
>>
>> Hrm, looking at this again, I notice that there is a single DEFINE_EVENT
>> using net_dev_template_simple.
>>
>> We could simply turn netif_receive_skb_list_exit into a TRACE_EVENT(),
>> remove the net_dev_template_simple, and rename the net_dev_template_return
>> to net_dev_template ?
>
> This too is only cosmetic and doesn't affect the code at all, because a
> TRACE_EVENT() is really just:
>
> #define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
> DECLARE_EVENT_CLASS(name, \
> PARAMS(proto), \
> PARAMS(args), \
> PARAMS(tstruct), \
> PARAMS(assign), \
> PARAMS(print)); \
> DEFINE_EVENT(name, name, PARAMS(proto), PARAMS(args));
>
> -- Steve
>
Of course.
I also notice that in two cases, a "gro_result_t" is implicitly cast
to "int". I usually frown upon this kind of stuff, because it's asking
for trouble if gro_result_t typedef to something else than "int" in the
future.
I would recommend going for two templates, one which takes a "int"
ret parameter, and the other a "gro_result_t" ret parameter.
Or am I being too cautious ?
Thanks,
Mathieu
>>
>> It's pretty clear from the prototype that it expects a "ret" argument,
>> so I don't see the need to also state it in the template name.
>>
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply
* Re: [PATCH 0/4] Add SOCFPGA System Manager
From: Lee Jones @ 2018-11-13 6:39 UTC (permalink / raw)
To: Thor Thayer
Cc: peppe.cavallaro, dinguyen, linux, alexandre.torgue, joabreu,
davem, mchehab+samsung, catalin.marinas, akpm, arnd, aisheng.dong,
linux-kernel, netdev, linux-arm-kernel
In-Reply-To: <c08bf646-bf9f-5dad-acc8-6975acd6cff3@linux.intel.com>
On Fri, 09 Nov 2018, Thor Thayer wrote:
> Hi
>
> On 10/19/18 1:16 AM, Lee Jones wrote:
> > On Wed, 17 Oct 2018, Thor Thayer wrote:
> >
> >
> > > On 10/10/2018 09:42 AM, Thor Thayer wrote:
> > > > Hi
> > > > On 09/24/2018 05:09 PM, thor.thayer@linux.intel.com wrote:
> > > > > From: Thor Thayer <thor.thayer@linux.intel.com>
> > > > >
> > > > > Add MFD driver for ARM64 SOCFPGA System Manager to steer
> > > > > System Manager calls appropriately.
> > > > > The SOCFPGA System Manager includes registers from several
> > > > > SOC peripherals.
> > > > >
> > > > > On ARM32, syscon handles this aggregated register grouping.
> > > > > Redirect System Manager calls to syscon for ARM32 SOCFPGA
> > > > > systems.
> > > > >
> > > > > The ARM64 System Manager can only be accessed from priority
> > > > > level EL3 so this new MFD driver handles the calls to EL3.
> > > > >
> > > > > Thor Thayer (4):
> > > > > mfd: altera-sysmgr: Add SOCFPGA System Manager abstraction
> > > > > ARM: socfpga_defconfig: Enable CONFIG_MTD_ALTERA_SYSMGR
> > > > > arm64: defconfig: Enable CONFIG_MTD_ALTERA_SYSMGR
> > > > > net: stmmac: socfpga: Convert to shared System Manager driver
> > > > >
> > > > > MAINTAINERS | 6 +
> > > > > arch/arm/configs/socfpga_defconfig | 1 +
> > > > > arch/arm64/configs/defconfig | 1 +
> > > > > drivers/mfd/Kconfig | 9 +
> > > > > drivers/mfd/Makefile | 1 +
> > > > > drivers/mfd/altera-sysmgr.c | 310
> > > > > +++++++++++++++++++++
> > > > > .../net/ethernet/stmicro/stmmac/dwmac-socfpga.c | 4 +-
> > > > > include/linux/mfd/altera-sysmgr.h | 113 ++++++++
> > > > > 8 files changed, 444 insertions(+), 1 deletion(-)
> > > > > create mode 100644 drivers/mfd/altera-sysmgr.c
> > > > > create mode 100644 include/linux/mfd/altera-sysmgr.h
> > > > >
> > > > Gentle ping.
> > >
> > > Gentle ping again...
> > >
> > > Any comments on this patch series?
> >
> > "Please don't send content free pings and please allow a reasonable time
> > for review. People get busy, go on holiday, attend conferences and so
> > on so unless there is some reason for urgency (like critical bug fixes)
> > please allow at least a couple of weeks for review. If there have been
> > review comments then people may be waiting for those to be addressed.
> > Sending content free pings just adds to the mail volume (if they are
> > seen at all) and if something has gone wrong you'll have to resend the
> > patches anyway so resending with any comments addressed is generally a
> > much better approach."
> >
> > In this case, the we are too late in the series to have these
> > applied. Maintainers are generally preparing their submissions for
> > the merge-window. The MFD component of this set is marked as "To
> > Review" and I will get around to it when time is more abundant.
> >
>
> Gentle ping now that the merge window is over.
>
> I'm not clear on the scolding for content free pings.
>
> Other pings I've seen just reference the patch series summary instead of
> each patch individually. It seems like pings for each patch would add more
> to the mail volume than the summary but perhaps I'm misunderstanding
> something. I'm happy to ping each patch separately if that is preferable.
Please don't ping at all. If you would like to attract attention,
please resend your patch-set with s/[PATCH]/[RESEND]/.
> Series can be found here:
> https://patchwork.kernel.org/cover/10612891/
>
> [PATCH 1/4] mfd: altera-sysmgr: Add SOCFPGA System Manager
> [PATCH 2/4] ARM: socfpga_defconfig: Enable CONFIG_MTD_ALTERA_SYSMGR
> [PATCH 3/4] arm64: defconfig: Enable CONFIG_MTD_ALTERA_SYSMGR
> [PATCH 4/4] net: stmmac: socfpga: Use shared System Manager driver
>
> Thanks,
>
> Thor
--
Lee Jones [李琼斯]
Linaro Services Technical Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog
^ permalink raw reply
* Re: [PATCH mlx5-next 00/10] Collection of ODP fixes
From: Leon Romanovsky @ 2018-11-12 20:43 UTC (permalink / raw)
To: Doug Ledford, Jason Gunthorpe
Cc: RDMA mailing list, Artemy Kovalyov, Majd Dibbiny, Moni Shoua,
Saeed Mahameed, linux-netdev
In-Reply-To: <20181108191017.21891-1-leon@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 2622 bytes --]
On Thu, Nov 08, 2018 at 09:10:07PM +0200, Leon Romanovsky wrote:
> From: Leon Romanovsky <leonro@mellanox.com>
>
> Hi,
>
> This is collection of fixes to mlx5_core and mlx5_ib ODP logic.
> There are two main reasons why we decided to forward it to mlx5-next
> and not to rdma-rc or net like our other fixes.
>
> 1. We have large number of patches exactly in that area that are ready
> for submission and we don't want to create extra merge work for
> maintainers due to that. Among those future series (already ready and
> tested): internal change of mlx5_core pagefaults handling, moving ODP
> code to RDMA, change in EQ mechanism, simplification and moving SRQ QP
> to RDMA, extra fixes to mlx5_ib ODP and ODP SRQ support.
>
> 2. Most of those fixes are for old bugs and there is no rush to fix them
> right now (in -rc1/-rc2).
>
> Thanks
>
> Moni Shoua (10):
> net/mlx5: Release resource on error flow
> net/mlx5: Add interface to hold and release core resources
> net/mlx5: Enumerate page fault types
> IB/mlx5: Lock QP during page fault handling
> net/mlx5: Return success for PAGE_FAULT_RESUME in internal error state
> net/mlx5: Use multi threaded workqueue for page fault handling
> IB/mlx5: Improve ODP debugging messages
Applied to mlx5-next
b02394aa75e3 IB/mlx5: Improve ODP debugging messages
90290db7669b net/mlx5: Use multi threaded workqueue for page fault handling
ef90c5e9757d net/mlx5: Return success for PAGE_FAULT_RESUME in internal error state
032080ab43ac IB/mlx5: Lock QP during page fault handling
c99fefea2cc9 net/mlx5: Enumerate page fault types
27e95603f4df net/mlx5: Add interface to hold and release core resources
698114968a22 net/mlx5: Release resource on error flow
> IB/mlx5: Avoid hangs due to a missing completion
> IB/mlx5: Call PAGE_FAULT_RESUME command asynchronously
Dropped to address feedback.
> net/mlx5: Remove unused function
Dropped, because it depends on dropped commit.
Thanks
>
> drivers/infiniband/core/umem_odp.c | 14 +-
> drivers/infiniband/hw/mlx5/mlx5_ib.h | 1 +
> drivers/infiniband/hw/mlx5/mr.c | 15 +-
> drivers/infiniband/hw/mlx5/odp.c | 158 ++++++++++++++----
> drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 2 +-
> drivers/net/ethernet/mellanox/mlx5/core/eq.c | 21 +--
> drivers/net/ethernet/mellanox/mlx5/core/qp.c | 20 ++-
> include/linux/mlx5/device.h | 7 +
> include/linux/mlx5/driver.h | 7 +-
> include/linux/mlx5/qp.h | 5 +
> 10 files changed, 191 insertions(+), 59 deletions(-)
>
> --
> 2.19.1
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* Re: [PATCH v2] net: Add trace events for all receive exit points
From: Steven Rostedt @ 2018-11-12 20:40 UTC (permalink / raw)
To: Mathieu Desnoyers
Cc: Geneviève Bastien, David S. Miller, netdev, Ingo Molnar
In-Reply-To: <2134979231.4006.1542054055701.JavaMail.zimbra@efficios.com>
On Mon, 12 Nov 2018 15:20:55 -0500 (EST)
Mathieu Desnoyers <mathieu.desnoyers@efficios.com> wrote:
>
> Hrm, looking at this again, I notice that there is a single DEFINE_EVENT
> using net_dev_template_simple.
>
> We could simply turn netif_receive_skb_list_exit into a TRACE_EVENT(),
> remove the net_dev_template_simple, and rename the net_dev_template_return
> to net_dev_template ?
This too is only cosmetic and doesn't affect the code at all, because a
TRACE_EVENT() is really just:
#define TRACE_EVENT(name, proto, args, tstruct, assign, print) \
DECLARE_EVENT_CLASS(name, \
PARAMS(proto), \
PARAMS(args), \
PARAMS(tstruct), \
PARAMS(assign), \
PARAMS(print)); \
DEFINE_EVENT(name, name, PARAMS(proto), PARAMS(args));
-- Steve
>
> It's pretty clear from the prototype that it expects a "ret" argument,
> so I don't see the need to also state it in the template name.
>
>
^ permalink raw reply
* Re: [PATCH v2] net: Add trace events for all receive exit points
From: Mathieu Desnoyers @ 2018-11-12 20:37 UTC (permalink / raw)
To: Geneviève Bastien; +Cc: David S. Miller, netdev, rostedt, Ingo Molnar
In-Reply-To: <2134979231.4006.1542054055701.JavaMail.zimbra@efficios.com>
----- On Nov 12, 2018, at 3:20 PM, Mathieu Desnoyers mathieu.desnoyers@efficios.com wrote:
> ----- On Nov 12, 2018, at 3:09 PM, Mathieu Desnoyers
> mathieu.desnoyers@efficios.com wrote:
>
>> ----- On Nov 12, 2018, at 2:44 PM, Geneviève Bastien gbastien@versatic.net
>> wrote:
>>
>>> Trace events are already present for the receive entry points, to indicate
>>> how the reception entered the stack.
>>>
>>> This patch adds the corresponding exit trace events that will bound the
>>> reception such that all events occurring between the entry and the exit
>>> can be considered as part of the reception context. This greatly helps
>>> for dependency and root cause analyses.
>>>
>>> Without this, it is impossible to determine whether a sched_wakeup
>>> event following a netif_receive_skb event is the result of the packet
>>> reception or a simple coincidence after further processing by the
>>> thread.
>>
>> As discussed over IRC, it is _possible_ to use kretprobes to instrument
>> the exit, but it is not practical. A v3 will be sent soon to clarify
>> this part of the commit message.
>>
>> Also, I wonder if we should use "net_dev_template_exit" for the event
>> class rather than "net_dev_template_return" ?
>
> Hrm, looking at this again, I notice that there is a single DEFINE_EVENT
> using net_dev_template_simple.
>
> We could simply turn netif_receive_skb_list_exit into a TRACE_EVENT(),
> remove the net_dev_template_simple, and rename the net_dev_template_return
> to net_dev_template ?
>
> It's pretty clear from the prototype that it expects a "ret" argument,
> so I don't see the need to also state it in the template name.
As you pointed out on IRC, net_dev_template already exists. So we can
use "net_dev_rx_exit_template" which is along the same lines as
its entry counterpart "net_dev_rx_verbose_template".
Thanks,
Mathieu
>
> Thanks,
>
> Mathieu
>
>>
>> Thanks,
>>
>> Mathieu
>>
>>>
>>> Signed-off-by: Geneviève Bastien <gbastien@versatic.net>
>>> CC: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>>> CC: Steven Rostedt <rostedt@goodmis.org>
>>> CC: Ingo Molnar <mingo@redhat.com>
>>> CC: David S. Miller <davem@davemloft.net>
>>> ---
>>> Changes in v2:
>>> - Add the return value to tracepoints where applicable
>>> - Verify if tracepoint is enabled before walking list in
>>> netif_receive_skb_list
>>> ---
>>> include/trace/events/net.h | 78 ++++++++++++++++++++++++++++++++++++++
>>> net/core/dev.c | 38 ++++++++++++++++---
>>> 2 files changed, 110 insertions(+), 6 deletions(-)
>>>
>>> diff --git a/include/trace/events/net.h b/include/trace/events/net.h
>>> index 00aa72ce0e7c..cff1a7b9d0bb 100644
>>> --- a/include/trace/events/net.h
>>> +++ b/include/trace/events/net.h
>>> @@ -117,6 +117,42 @@ DECLARE_EVENT_CLASS(net_dev_template,
>>> __get_str(name), __entry->skbaddr, __entry->len)
>>> )
>>>
>>> +DECLARE_EVENT_CLASS(net_dev_template_return,
>>> +
>>> + TP_PROTO(struct sk_buff *skb, int ret),
>>> +
>>> + TP_ARGS(skb, ret),
>>> +
>>> + TP_STRUCT__entry(
>>> + __field(void *, skbaddr)
>>> + __field(int, ret)
>>> + ),
>>> +
>>> + TP_fast_assign(
>>> + __entry->skbaddr = skb;
>>> + __entry->ret = ret;
>>> + ),
>>> +
>>> + TP_printk("skbaddr=%p ret=%d", __entry->skbaddr, __entry->ret)
>>> +)
>>> +
>>> +DECLARE_EVENT_CLASS(net_dev_template_simple,
>>> +
>>> + TP_PROTO(struct sk_buff *skb),
>>> +
>>> + TP_ARGS(skb),
>>> +
>>> + TP_STRUCT__entry(
>>> + __field(void *, skbaddr)
>>> + ),
>>> +
>>> + TP_fast_assign(
>>> + __entry->skbaddr = skb;
>>> + ),
>>> +
>>> + TP_printk("skbaddr=%p", __entry->skbaddr)
>>> +)
>>> +
>>> DEFINE_EVENT(net_dev_template, net_dev_queue,
>>>
>>> TP_PROTO(struct sk_buff *skb),
>>> @@ -244,6 +280,48 @@ DEFINE_EVENT(net_dev_rx_verbose_template,
>>> netif_rx_ni_entry,
>>> TP_ARGS(skb)
>>> );
>>>
>>> +DEFINE_EVENT(net_dev_template_return, napi_gro_frags_exit,
>>> +
>>> + TP_PROTO(struct sk_buff *skb, int ret),
>>> +
>>> + TP_ARGS(skb, ret)
>>> +);
>>> +
>>> +DEFINE_EVENT(net_dev_template_return, napi_gro_receive_exit,
>>> +
>>> + TP_PROTO(struct sk_buff *skb, int ret),
>>> +
>>> + TP_ARGS(skb, ret)
>>> +);
>>> +
>>> +DEFINE_EVENT(net_dev_template_return, netif_receive_skb_exit,
>>> +
>>> + TP_PROTO(struct sk_buff *skb, int ret),
>>> +
>>> + TP_ARGS(skb, ret)
>>> +);
>>> +
>>> +DEFINE_EVENT(net_dev_template_simple, netif_receive_skb_list_exit,
>>> +
>>> + TP_PROTO(struct sk_buff *skb),
>>> +
>>> + TP_ARGS(skb)
>>> +);
>>> +
>>> +DEFINE_EVENT(net_dev_template_return, netif_rx_exit,
>>> +
>>> + TP_PROTO(struct sk_buff *skb, int ret),
>>> +
>>> + TP_ARGS(skb, ret)
>>> +);
>>> +
>>> +DEFINE_EVENT(net_dev_template_return, netif_rx_ni_exit,
>>> +
>>> + TP_PROTO(struct sk_buff *skb, int ret),
>>> +
>>> + TP_ARGS(skb, ret)
>>> +);
>>> +
>>> #endif /* _TRACE_NET_H */
>>>
>>> /* This part must be outside protection */
>>> diff --git a/net/core/dev.c b/net/core/dev.c
>>> index 0ffcbdd55fa9..c4dc5df34abe 100644
>>> --- a/net/core/dev.c
>>> +++ b/net/core/dev.c
>>> @@ -4520,9 +4520,14 @@ static int netif_rx_internal(struct sk_buff *skb)
>>>
>>> int netif_rx(struct sk_buff *skb)
>>> {
>>> + int ret;
>>> +
>>> trace_netif_rx_entry(skb);
>>>
>>> - return netif_rx_internal(skb);
>>> + ret = netif_rx_internal(skb);
>>> + trace_netif_rx_exit(skb, ret);
>>> +
>>> + return ret;
>>> }
>>> EXPORT_SYMBOL(netif_rx);
>>>
>>> @@ -4537,6 +4542,7 @@ int netif_rx_ni(struct sk_buff *skb)
>>> if (local_softirq_pending())
>>> do_softirq();
>>> preempt_enable();
>>> + trace_netif_rx_ni_exit(skb, err);
>>>
>>> return err;
>>> }
>>> @@ -5222,9 +5228,14 @@ static void netif_receive_skb_list_internal(struct
>>> list_head *head)
>>> */
>>> int netif_receive_skb(struct sk_buff *skb)
>>> {
>>> + int ret;
>>> +
>>> trace_netif_receive_skb_entry(skb);
>>>
>>> - return netif_receive_skb_internal(skb);
>>> + ret = netif_receive_skb_internal(skb);
>>> + trace_netif_receive_skb_exit(skb, ret);
>>> +
>>> + return ret;
>>> }
>>> EXPORT_SYMBOL(netif_receive_skb);
>>>
>>> @@ -5244,9 +5255,15 @@ void netif_receive_skb_list(struct list_head *head)
>>>
>>> if (list_empty(head))
>>> return;
>>> - list_for_each_entry(skb, head, list)
>>> - trace_netif_receive_skb_list_entry(skb);
>>> + if (trace_netif_receive_skb_list_entry_enabled()) {
>>> + list_for_each_entry(skb, head, list)
>>> + trace_netif_receive_skb_list_entry(skb);
>>> + }
>>> netif_receive_skb_list_internal(head);
>>> + if (trace_netif_receive_skb_list_exit_enabled()) {
>>> + list_for_each_entry(skb, head, list)
>>> + trace_netif_receive_skb_list_exit(skb);
>>> + }
>>> }
>>> EXPORT_SYMBOL(netif_receive_skb_list);
>>>
>>> @@ -5634,12 +5651,17 @@ static gro_result_t napi_skb_finish(gro_result_t ret,
>>> struct sk_buff *skb)
>>>
>>> gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
>>> {
>>> + gro_result_t ret;
>>> +
>>> skb_mark_napi_id(skb, napi);
>>> trace_napi_gro_receive_entry(skb);
>>>
>>> skb_gro_reset_offset(skb);
>>>
>>> - return napi_skb_finish(dev_gro_receive(napi, skb), skb);
>>> + ret = napi_skb_finish(dev_gro_receive(napi, skb), skb);
>>> + trace_napi_gro_receive_exit(skb, ret);
>>> +
>>> + return ret;
>>> }
>>> EXPORT_SYMBOL(napi_gro_receive);
>>>
>>> @@ -5753,6 +5775,7 @@ static struct sk_buff *napi_frags_skb(struct napi_struct
>>> *napi)
>>>
>>> gro_result_t napi_gro_frags(struct napi_struct *napi)
>>> {
>>> + gro_result_t ret;
>>> struct sk_buff *skb = napi_frags_skb(napi);
>>>
>>> if (!skb)
>>> @@ -5760,7 +5783,10 @@ gro_result_t napi_gro_frags(struct napi_struct *napi)
>>>
>>> trace_napi_gro_frags_entry(skb);
>>>
>>> - return napi_frags_finish(napi, skb, dev_gro_receive(napi, skb));
>>> + ret = napi_frags_finish(napi, skb, dev_gro_receive(napi, skb));
>>> + trace_napi_gro_frags_exit(skb, ret);
>>> +
>>> + return ret;
>>> }
>>> EXPORT_SYMBOL(napi_gro_frags);
>>>
>>> --
>>> 2.19.1
>>
>> --
>> Mathieu Desnoyers
>> EfficiOS Inc.
>> http://www.efficios.com
>
> --
> Mathieu Desnoyers
> EfficiOS Inc.
> http://www.efficios.com
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply
* Re: [PATCH bpf-next] bpftool: make libbfd optional
From: Jakub Kicinski @ 2018-11-12 20:35 UTC (permalink / raw)
To: Stanislav Fomichev
Cc: Stanislav Fomichev, netdev, ast, daniel, quentin.monnet
In-Reply-To: <20181112195827.l5xz5qko7l6leqhp@mini-arch>
On Mon, 12 Nov 2018 11:58:27 -0800, Stanislav Fomichev wrote:
> On 11/12, Jakub Kicinski wrote:
> > On Mon, 12 Nov 2018 10:53:28 -0800, Stanislav Fomichev wrote:
> > > diff --git a/tools/bpf/bpftool/main.h b/tools/bpf/bpftool/main.h
> > > index 61d82020af58..ec1bc2ae3c71 100644
> > > --- a/tools/bpf/bpftool/main.h
> > > +++ b/tools/bpf/bpftool/main.h
> > > @@ -147,8 +147,19 @@ int prog_parse_fd(int *argc, char ***argv);
> > > int map_parse_fd(int *argc, char ***argv);
> > > int map_parse_fd_and_info(int *argc, char ***argv, void *info, __u32 *info_len);
> > >
> > > +#ifdef HAVE_LIBBFD_SUPPORT
> > > void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
> > > const char *arch, const char *disassembler_options);
> > > +void disasm_init(void);
> > > +#else
> > > +static inline
> > > +void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
> > > + const char *arch, const char *disassembler_options)
> > > +{
> > > + p_err("No libbfd support");
> > > +}
> >
> > I think an error per instruction is a bit much, could we make sure we
> > error out earlier?
>
> I can return int from disasm_print_insn as an indication to
> stop/continue. Let me know if you have better ideas, will post v2 later
> today.
Why not simply:
diff --git a/tools/bpf/bpftool/prog.c b/tools/bpf/bpftool/prog.c
index 5302ee282409..44edf6705ad2 100644
--- a/tools/bpf/bpftool/prog.c
+++ b/tools/bpf/bpftool/prog.c
@@ -466,6 +466,10 @@ static int do_dump(int argc, char **argv)
int fd;
if (is_prefix(*argv, "jited")) {
+#ifndef HAVE_LIBBFD_SUPPORT
+ p_err("No libbfd support");
+ return -1;
+#endif
member_len = &info.jited_prog_len;
member_ptr = &info.jited_prog_insns;
} else if (is_prefix(*argv, "xlated")) {
Perhaps wrapped into some helper in the header to avoid the yuckiness.
^ permalink raw reply related
* Re: [PATCH v2] net: Add trace events for all receive exit points
From: Steven Rostedt @ 2018-11-12 20:32 UTC (permalink / raw)
To: Geneviève Bastien; +Cc: davem, netdev, Mathieu Desnoyers, Ingo Molnar
In-Reply-To: <20181112194405.4133-1-gbastien@versatic.net>
On Mon, 12 Nov 2018 14:44:05 -0500
Geneviève Bastien <gbastien@versatic.net> wrote:
> Trace events are already present for the receive entry points, to indicate
> how the reception entered the stack.
>
> This patch adds the corresponding exit trace events that will bound the
> reception such that all events occurring between the entry and the exit
> can be considered as part of the reception context. This greatly helps
> for dependency and root cause analyses.
>
> Without this, it is impossible to determine whether a sched_wakeup
> event following a netif_receive_skb event is the result of the packet
> reception or a simple coincidence after further processing by the
> thread.
>
> Signed-off-by: Geneviève Bastien <gbastien@versatic.net>
> CC: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> CC: Steven Rostedt <rostedt@goodmis.org>
> CC: Ingo Molnar <mingo@redhat.com>
> CC: David S. Miller <davem@davemloft.net>
> ---
> Changes in v2:
> - Add the return value to tracepoints where applicable
> - Verify if tracepoint is enabled before walking list in
> netif_receive_skb_list
> ---
> include/trace/events/net.h | 78 ++++++++++++++++++++++++++++++++++++++
> net/core/dev.c | 38 ++++++++++++++++---
> 2 files changed, 110 insertions(+), 6 deletions(-)
>
> diff --git a/include/trace/events/net.h b/include/trace/events/net.h
> index 00aa72ce0e7c..cff1a7b9d0bb 100644
> --- a/include/trace/events/net.h
> +++ b/include/trace/events/net.h
> @@ -117,6 +117,42 @@ DECLARE_EVENT_CLASS(net_dev_template,
> __get_str(name), __entry->skbaddr, __entry->len)
> )
>
> +DECLARE_EVENT_CLASS(net_dev_template_return,
> +
> + TP_PROTO(struct sk_buff *skb, int ret),
> +
> + TP_ARGS(skb, ret),
> +
> + TP_STRUCT__entry(
> + __field(void *, skbaddr)
> + __field(int, ret)
> + ),
> +
> + TP_fast_assign(
> + __entry->skbaddr = skb;
> + __entry->ret = ret;
> + ),
> +
> + TP_printk("skbaddr=%p ret=%d", __entry->skbaddr, __entry->ret)
> +)
> +
> +DECLARE_EVENT_CLASS(net_dev_template_simple,
> +
> + TP_PROTO(struct sk_buff *skb),
> +
> + TP_ARGS(skb),
> +
> + TP_STRUCT__entry(
> + __field(void *, skbaddr)
> + ),
> +
> + TP_fast_assign(
> + __entry->skbaddr = skb;
> + ),
> +
> + TP_printk("skbaddr=%p", __entry->skbaddr)
> +)
> +
> DEFINE_EVENT(net_dev_template, net_dev_queue,
>
> TP_PROTO(struct sk_buff *skb),
> @@ -244,6 +280,48 @@ DEFINE_EVENT(net_dev_rx_verbose_template, netif_rx_ni_entry,
> TP_ARGS(skb)
> );
>
> +DEFINE_EVENT(net_dev_template_return, napi_gro_frags_exit,
> +
> + TP_PROTO(struct sk_buff *skb, int ret),
> +
> + TP_ARGS(skb, ret)
> +);
> +
> +DEFINE_EVENT(net_dev_template_return, napi_gro_receive_exit,
> +
> + TP_PROTO(struct sk_buff *skb, int ret),
> +
> + TP_ARGS(skb, ret)
> +);
> +
> +DEFINE_EVENT(net_dev_template_return, netif_receive_skb_exit,
> +
> + TP_PROTO(struct sk_buff *skb, int ret),
> +
> + TP_ARGS(skb, ret)
> +);
> +
> +DEFINE_EVENT(net_dev_template_simple, netif_receive_skb_list_exit,
One small nit, and I don't care enough to ask you to fix it, but others
might care. We probably should not intermix net_dev_template_simple
events within net_dev_template_return events.
But like I said, I don't really care, it's more cosmetic than anything
else.
For the tracing side:
Reviewed-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
-- Steve
> +
> + TP_PROTO(struct sk_buff *skb),
> +
> + TP_ARGS(skb)
> +);
> +
> +DEFINE_EVENT(net_dev_template_return, netif_rx_exit,
> +
> + TP_PROTO(struct sk_buff *skb, int ret),
> +
> + TP_ARGS(skb, ret)
> +);
> +
> +DEFINE_EVENT(net_dev_template_return, netif_rx_ni_exit,
> +
> + TP_PROTO(struct sk_buff *skb, int ret),
> +
> + TP_ARGS(skb, ret)
> +);
> +
> #endif /* _TRACE_NET_H */
>
>
^ permalink raw reply
* Re: [PATCH net-next] net: phy: check for implementation of both callbacks in phy_drv_supports_irq
From: Florian Fainelli @ 2018-11-12 20:22 UTC (permalink / raw)
To: Heiner Kallweit, Andrew Lunn, David Miller; +Cc: netdev@vger.kernel.org
In-Reply-To: <d6f37c41-76f1-56ce-0047-c44224b7ff96@gmail.com>
On 11/12/18 12:16 PM, Heiner Kallweit wrote:
> Now that the icplus driver has been fixed all PHY drivers supporting
> interrupts have both callbacks (config_intr and ack_interrupt)
> implemented - as it should be. Therefore phy_drv_supports_irq()
> can be changed now to check for both callbacks being implemented.
>
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply
* Re: [PATCH v2] net: Add trace events for all receive exit points
From: Mathieu Desnoyers @ 2018-11-12 20:20 UTC (permalink / raw)
To: Geneviève Bastien; +Cc: David S. Miller, netdev, rostedt, Ingo Molnar
In-Reply-To: <879033794.3997.1542053367213.JavaMail.zimbra@efficios.com>
----- On Nov 12, 2018, at 3:09 PM, Mathieu Desnoyers mathieu.desnoyers@efficios.com wrote:
> ----- On Nov 12, 2018, at 2:44 PM, Geneviève Bastien gbastien@versatic.net
> wrote:
>
>> Trace events are already present for the receive entry points, to indicate
>> how the reception entered the stack.
>>
>> This patch adds the corresponding exit trace events that will bound the
>> reception such that all events occurring between the entry and the exit
>> can be considered as part of the reception context. This greatly helps
>> for dependency and root cause analyses.
>>
>> Without this, it is impossible to determine whether a sched_wakeup
>> event following a netif_receive_skb event is the result of the packet
>> reception or a simple coincidence after further processing by the
>> thread.
>
> As discussed over IRC, it is _possible_ to use kretprobes to instrument
> the exit, but it is not practical. A v3 will be sent soon to clarify
> this part of the commit message.
>
> Also, I wonder if we should use "net_dev_template_exit" for the event
> class rather than "net_dev_template_return" ?
Hrm, looking at this again, I notice that there is a single DEFINE_EVENT
using net_dev_template_simple.
We could simply turn netif_receive_skb_list_exit into a TRACE_EVENT(),
remove the net_dev_template_simple, and rename the net_dev_template_return
to net_dev_template ?
It's pretty clear from the prototype that it expects a "ret" argument,
so I don't see the need to also state it in the template name.
Thanks,
Mathieu
>
> Thanks,
>
> Mathieu
>
>>
>> Signed-off-by: Geneviève Bastien <gbastien@versatic.net>
>> CC: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>> CC: Steven Rostedt <rostedt@goodmis.org>
>> CC: Ingo Molnar <mingo@redhat.com>
>> CC: David S. Miller <davem@davemloft.net>
>> ---
>> Changes in v2:
>> - Add the return value to tracepoints where applicable
>> - Verify if tracepoint is enabled before walking list in
>> netif_receive_skb_list
>> ---
>> include/trace/events/net.h | 78 ++++++++++++++++++++++++++++++++++++++
>> net/core/dev.c | 38 ++++++++++++++++---
>> 2 files changed, 110 insertions(+), 6 deletions(-)
>>
>> diff --git a/include/trace/events/net.h b/include/trace/events/net.h
>> index 00aa72ce0e7c..cff1a7b9d0bb 100644
>> --- a/include/trace/events/net.h
>> +++ b/include/trace/events/net.h
>> @@ -117,6 +117,42 @@ DECLARE_EVENT_CLASS(net_dev_template,
>> __get_str(name), __entry->skbaddr, __entry->len)
>> )
>>
>> +DECLARE_EVENT_CLASS(net_dev_template_return,
>> +
>> + TP_PROTO(struct sk_buff *skb, int ret),
>> +
>> + TP_ARGS(skb, ret),
>> +
>> + TP_STRUCT__entry(
>> + __field(void *, skbaddr)
>> + __field(int, ret)
>> + ),
>> +
>> + TP_fast_assign(
>> + __entry->skbaddr = skb;
>> + __entry->ret = ret;
>> + ),
>> +
>> + TP_printk("skbaddr=%p ret=%d", __entry->skbaddr, __entry->ret)
>> +)
>> +
>> +DECLARE_EVENT_CLASS(net_dev_template_simple,
>> +
>> + TP_PROTO(struct sk_buff *skb),
>> +
>> + TP_ARGS(skb),
>> +
>> + TP_STRUCT__entry(
>> + __field(void *, skbaddr)
>> + ),
>> +
>> + TP_fast_assign(
>> + __entry->skbaddr = skb;
>> + ),
>> +
>> + TP_printk("skbaddr=%p", __entry->skbaddr)
>> +)
>> +
>> DEFINE_EVENT(net_dev_template, net_dev_queue,
>>
>> TP_PROTO(struct sk_buff *skb),
>> @@ -244,6 +280,48 @@ DEFINE_EVENT(net_dev_rx_verbose_template,
>> netif_rx_ni_entry,
>> TP_ARGS(skb)
>> );
>>
>> +DEFINE_EVENT(net_dev_template_return, napi_gro_frags_exit,
>> +
>> + TP_PROTO(struct sk_buff *skb, int ret),
>> +
>> + TP_ARGS(skb, ret)
>> +);
>> +
>> +DEFINE_EVENT(net_dev_template_return, napi_gro_receive_exit,
>> +
>> + TP_PROTO(struct sk_buff *skb, int ret),
>> +
>> + TP_ARGS(skb, ret)
>> +);
>> +
>> +DEFINE_EVENT(net_dev_template_return, netif_receive_skb_exit,
>> +
>> + TP_PROTO(struct sk_buff *skb, int ret),
>> +
>> + TP_ARGS(skb, ret)
>> +);
>> +
>> +DEFINE_EVENT(net_dev_template_simple, netif_receive_skb_list_exit,
>> +
>> + TP_PROTO(struct sk_buff *skb),
>> +
>> + TP_ARGS(skb)
>> +);
>> +
>> +DEFINE_EVENT(net_dev_template_return, netif_rx_exit,
>> +
>> + TP_PROTO(struct sk_buff *skb, int ret),
>> +
>> + TP_ARGS(skb, ret)
>> +);
>> +
>> +DEFINE_EVENT(net_dev_template_return, netif_rx_ni_exit,
>> +
>> + TP_PROTO(struct sk_buff *skb, int ret),
>> +
>> + TP_ARGS(skb, ret)
>> +);
>> +
>> #endif /* _TRACE_NET_H */
>>
>> /* This part must be outside protection */
>> diff --git a/net/core/dev.c b/net/core/dev.c
>> index 0ffcbdd55fa9..c4dc5df34abe 100644
>> --- a/net/core/dev.c
>> +++ b/net/core/dev.c
>> @@ -4520,9 +4520,14 @@ static int netif_rx_internal(struct sk_buff *skb)
>>
>> int netif_rx(struct sk_buff *skb)
>> {
>> + int ret;
>> +
>> trace_netif_rx_entry(skb);
>>
>> - return netif_rx_internal(skb);
>> + ret = netif_rx_internal(skb);
>> + trace_netif_rx_exit(skb, ret);
>> +
>> + return ret;
>> }
>> EXPORT_SYMBOL(netif_rx);
>>
>> @@ -4537,6 +4542,7 @@ int netif_rx_ni(struct sk_buff *skb)
>> if (local_softirq_pending())
>> do_softirq();
>> preempt_enable();
>> + trace_netif_rx_ni_exit(skb, err);
>>
>> return err;
>> }
>> @@ -5222,9 +5228,14 @@ static void netif_receive_skb_list_internal(struct
>> list_head *head)
>> */
>> int netif_receive_skb(struct sk_buff *skb)
>> {
>> + int ret;
>> +
>> trace_netif_receive_skb_entry(skb);
>>
>> - return netif_receive_skb_internal(skb);
>> + ret = netif_receive_skb_internal(skb);
>> + trace_netif_receive_skb_exit(skb, ret);
>> +
>> + return ret;
>> }
>> EXPORT_SYMBOL(netif_receive_skb);
>>
>> @@ -5244,9 +5255,15 @@ void netif_receive_skb_list(struct list_head *head)
>>
>> if (list_empty(head))
>> return;
>> - list_for_each_entry(skb, head, list)
>> - trace_netif_receive_skb_list_entry(skb);
>> + if (trace_netif_receive_skb_list_entry_enabled()) {
>> + list_for_each_entry(skb, head, list)
>> + trace_netif_receive_skb_list_entry(skb);
>> + }
>> netif_receive_skb_list_internal(head);
>> + if (trace_netif_receive_skb_list_exit_enabled()) {
>> + list_for_each_entry(skb, head, list)
>> + trace_netif_receive_skb_list_exit(skb);
>> + }
>> }
>> EXPORT_SYMBOL(netif_receive_skb_list);
>>
>> @@ -5634,12 +5651,17 @@ static gro_result_t napi_skb_finish(gro_result_t ret,
>> struct sk_buff *skb)
>>
>> gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
>> {
>> + gro_result_t ret;
>> +
>> skb_mark_napi_id(skb, napi);
>> trace_napi_gro_receive_entry(skb);
>>
>> skb_gro_reset_offset(skb);
>>
>> - return napi_skb_finish(dev_gro_receive(napi, skb), skb);
>> + ret = napi_skb_finish(dev_gro_receive(napi, skb), skb);
>> + trace_napi_gro_receive_exit(skb, ret);
>> +
>> + return ret;
>> }
>> EXPORT_SYMBOL(napi_gro_receive);
>>
>> @@ -5753,6 +5775,7 @@ static struct sk_buff *napi_frags_skb(struct napi_struct
>> *napi)
>>
>> gro_result_t napi_gro_frags(struct napi_struct *napi)
>> {
>> + gro_result_t ret;
>> struct sk_buff *skb = napi_frags_skb(napi);
>>
>> if (!skb)
>> @@ -5760,7 +5783,10 @@ gro_result_t napi_gro_frags(struct napi_struct *napi)
>>
>> trace_napi_gro_frags_entry(skb);
>>
>> - return napi_frags_finish(napi, skb, dev_gro_receive(napi, skb));
>> + ret = napi_frags_finish(napi, skb, dev_gro_receive(napi, skb));
>> + trace_napi_gro_frags_exit(skb, ret);
>> +
>> + return ret;
>> }
>> EXPORT_SYMBOL(napi_gro_frags);
>>
>> --
>> 2.19.1
>
> --
> Mathieu Desnoyers
> EfficiOS Inc.
> http://www.efficios.com
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply
* [PATCH net-next v2] geneve: Use empty braces for addr6 initializer
From: Nathan Chancellor @ 2018-11-13 6:11 UTC (permalink / raw)
To: David S. Miller
Cc: Stefano Brivio, Sabrina Dubroca, netdev, linux-kernel,
Joe Perches, Nathan Chancellor
In-Reply-To: <20181112221248.11477-1-natechancellor@gmail.com>
Clang warns:
drivers/net/geneve.c:428:29: error: suggest braces around initialization
of subobject [-Werror,-Wmissing-braces]
struct in6_addr addr6 = { 0 };
^
{}
Most initializations of structs in the kernel seem to use this format.
Fixes: a07966447f39 ("geneve: ICMP error lookup handler")
Suggested-by: Joe Perches <joe@perches.com>
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---
v1 -> v2:
* Just remove the zero instead of adding more braces as it seems to
match the rest of the kernel (as suggested by Joe Perches).
drivers/net/geneve.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 7c53e06b31c3..f09e58b7b01e 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -425,7 +425,7 @@ static int geneve_udp_encap_err_lookup(struct sock *sk, struct sk_buff *skb)
#if IS_ENABLED(CONFIG_IPV6)
if (geneve_get_sk_family(gs) == AF_INET6) {
struct ipv6hdr *ip6h = ipv6_hdr(skb);
- struct in6_addr addr6 = { 0 };
+ struct in6_addr addr6 = { };
if (!gs->collect_md) {
vni = geneve_hdr(skb)->vni;
--
2.19.1
^ permalink raw reply related
* [PATCH net-next] net: phy: check for implementation of both callbacks in phy_drv_supports_irq
From: Heiner Kallweit @ 2018-11-12 20:16 UTC (permalink / raw)
To: Andrew Lunn, Florian Fainelli, David Miller; +Cc: netdev@vger.kernel.org
Now that the icplus driver has been fixed all PHY drivers supporting
interrupts have both callbacks (config_intr and ack_interrupt)
implemented - as it should be. Therefore phy_drv_supports_irq()
can be changed now to check for both callbacks being implemented.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/net/phy/phy_device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 55202a0ac..e06613f2d 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -2122,7 +2122,7 @@ static void of_set_phy_eee_broken(struct phy_device *phydev)
static bool phy_drv_supports_irq(struct phy_driver *phydrv)
{
- return phydrv->config_intr || phydrv->ack_interrupt;
+ return phydrv->config_intr && phydrv->ack_interrupt;
}
/**
--
2.19.1
^ permalink raw reply related
* Re: [PATCH v2] net: Add trace events for all receive exit points
From: Mathieu Desnoyers @ 2018-11-12 20:09 UTC (permalink / raw)
To: Geneviève Bastien; +Cc: David S. Miller, netdev, rostedt, Ingo Molnar
In-Reply-To: <20181112194405.4133-1-gbastien@versatic.net>
----- On Nov 12, 2018, at 2:44 PM, Geneviève Bastien gbastien@versatic.net wrote:
> Trace events are already present for the receive entry points, to indicate
> how the reception entered the stack.
>
> This patch adds the corresponding exit trace events that will bound the
> reception such that all events occurring between the entry and the exit
> can be considered as part of the reception context. This greatly helps
> for dependency and root cause analyses.
>
> Without this, it is impossible to determine whether a sched_wakeup
> event following a netif_receive_skb event is the result of the packet
> reception or a simple coincidence after further processing by the
> thread.
As discussed over IRC, it is _possible_ to use kretprobes to instrument
the exit, but it is not practical. A v3 will be sent soon to clarify
this part of the commit message.
Also, I wonder if we should use "net_dev_template_exit" for the event
class rather than "net_dev_template_return" ?
Thanks,
Mathieu
>
> Signed-off-by: Geneviève Bastien <gbastien@versatic.net>
> CC: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> CC: Steven Rostedt <rostedt@goodmis.org>
> CC: Ingo Molnar <mingo@redhat.com>
> CC: David S. Miller <davem@davemloft.net>
> ---
> Changes in v2:
> - Add the return value to tracepoints where applicable
> - Verify if tracepoint is enabled before walking list in
> netif_receive_skb_list
> ---
> include/trace/events/net.h | 78 ++++++++++++++++++++++++++++++++++++++
> net/core/dev.c | 38 ++++++++++++++++---
> 2 files changed, 110 insertions(+), 6 deletions(-)
>
> diff --git a/include/trace/events/net.h b/include/trace/events/net.h
> index 00aa72ce0e7c..cff1a7b9d0bb 100644
> --- a/include/trace/events/net.h
> +++ b/include/trace/events/net.h
> @@ -117,6 +117,42 @@ DECLARE_EVENT_CLASS(net_dev_template,
> __get_str(name), __entry->skbaddr, __entry->len)
> )
>
> +DECLARE_EVENT_CLASS(net_dev_template_return,
> +
> + TP_PROTO(struct sk_buff *skb, int ret),
> +
> + TP_ARGS(skb, ret),
> +
> + TP_STRUCT__entry(
> + __field(void *, skbaddr)
> + __field(int, ret)
> + ),
> +
> + TP_fast_assign(
> + __entry->skbaddr = skb;
> + __entry->ret = ret;
> + ),
> +
> + TP_printk("skbaddr=%p ret=%d", __entry->skbaddr, __entry->ret)
> +)
> +
> +DECLARE_EVENT_CLASS(net_dev_template_simple,
> +
> + TP_PROTO(struct sk_buff *skb),
> +
> + TP_ARGS(skb),
> +
> + TP_STRUCT__entry(
> + __field(void *, skbaddr)
> + ),
> +
> + TP_fast_assign(
> + __entry->skbaddr = skb;
> + ),
> +
> + TP_printk("skbaddr=%p", __entry->skbaddr)
> +)
> +
> DEFINE_EVENT(net_dev_template, net_dev_queue,
>
> TP_PROTO(struct sk_buff *skb),
> @@ -244,6 +280,48 @@ DEFINE_EVENT(net_dev_rx_verbose_template,
> netif_rx_ni_entry,
> TP_ARGS(skb)
> );
>
> +DEFINE_EVENT(net_dev_template_return, napi_gro_frags_exit,
> +
> + TP_PROTO(struct sk_buff *skb, int ret),
> +
> + TP_ARGS(skb, ret)
> +);
> +
> +DEFINE_EVENT(net_dev_template_return, napi_gro_receive_exit,
> +
> + TP_PROTO(struct sk_buff *skb, int ret),
> +
> + TP_ARGS(skb, ret)
> +);
> +
> +DEFINE_EVENT(net_dev_template_return, netif_receive_skb_exit,
> +
> + TP_PROTO(struct sk_buff *skb, int ret),
> +
> + TP_ARGS(skb, ret)
> +);
> +
> +DEFINE_EVENT(net_dev_template_simple, netif_receive_skb_list_exit,
> +
> + TP_PROTO(struct sk_buff *skb),
> +
> + TP_ARGS(skb)
> +);
> +
> +DEFINE_EVENT(net_dev_template_return, netif_rx_exit,
> +
> + TP_PROTO(struct sk_buff *skb, int ret),
> +
> + TP_ARGS(skb, ret)
> +);
> +
> +DEFINE_EVENT(net_dev_template_return, netif_rx_ni_exit,
> +
> + TP_PROTO(struct sk_buff *skb, int ret),
> +
> + TP_ARGS(skb, ret)
> +);
> +
> #endif /* _TRACE_NET_H */
>
> /* This part must be outside protection */
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 0ffcbdd55fa9..c4dc5df34abe 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -4520,9 +4520,14 @@ static int netif_rx_internal(struct sk_buff *skb)
>
> int netif_rx(struct sk_buff *skb)
> {
> + int ret;
> +
> trace_netif_rx_entry(skb);
>
> - return netif_rx_internal(skb);
> + ret = netif_rx_internal(skb);
> + trace_netif_rx_exit(skb, ret);
> +
> + return ret;
> }
> EXPORT_SYMBOL(netif_rx);
>
> @@ -4537,6 +4542,7 @@ int netif_rx_ni(struct sk_buff *skb)
> if (local_softirq_pending())
> do_softirq();
> preempt_enable();
> + trace_netif_rx_ni_exit(skb, err);
>
> return err;
> }
> @@ -5222,9 +5228,14 @@ static void netif_receive_skb_list_internal(struct
> list_head *head)
> */
> int netif_receive_skb(struct sk_buff *skb)
> {
> + int ret;
> +
> trace_netif_receive_skb_entry(skb);
>
> - return netif_receive_skb_internal(skb);
> + ret = netif_receive_skb_internal(skb);
> + trace_netif_receive_skb_exit(skb, ret);
> +
> + return ret;
> }
> EXPORT_SYMBOL(netif_receive_skb);
>
> @@ -5244,9 +5255,15 @@ void netif_receive_skb_list(struct list_head *head)
>
> if (list_empty(head))
> return;
> - list_for_each_entry(skb, head, list)
> - trace_netif_receive_skb_list_entry(skb);
> + if (trace_netif_receive_skb_list_entry_enabled()) {
> + list_for_each_entry(skb, head, list)
> + trace_netif_receive_skb_list_entry(skb);
> + }
> netif_receive_skb_list_internal(head);
> + if (trace_netif_receive_skb_list_exit_enabled()) {
> + list_for_each_entry(skb, head, list)
> + trace_netif_receive_skb_list_exit(skb);
> + }
> }
> EXPORT_SYMBOL(netif_receive_skb_list);
>
> @@ -5634,12 +5651,17 @@ static gro_result_t napi_skb_finish(gro_result_t ret,
> struct sk_buff *skb)
>
> gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
> {
> + gro_result_t ret;
> +
> skb_mark_napi_id(skb, napi);
> trace_napi_gro_receive_entry(skb);
>
> skb_gro_reset_offset(skb);
>
> - return napi_skb_finish(dev_gro_receive(napi, skb), skb);
> + ret = napi_skb_finish(dev_gro_receive(napi, skb), skb);
> + trace_napi_gro_receive_exit(skb, ret);
> +
> + return ret;
> }
> EXPORT_SYMBOL(napi_gro_receive);
>
> @@ -5753,6 +5775,7 @@ static struct sk_buff *napi_frags_skb(struct napi_struct
> *napi)
>
> gro_result_t napi_gro_frags(struct napi_struct *napi)
> {
> + gro_result_t ret;
> struct sk_buff *skb = napi_frags_skb(napi);
>
> if (!skb)
> @@ -5760,7 +5783,10 @@ gro_result_t napi_gro_frags(struct napi_struct *napi)
>
> trace_napi_gro_frags_entry(skb);
>
> - return napi_frags_finish(napi, skb, dev_gro_receive(napi, skb));
> + ret = napi_frags_finish(napi, skb, dev_gro_receive(napi, skb));
> + trace_napi_gro_frags_exit(skb, ret);
> +
> + return ret;
> }
> EXPORT_SYMBOL(napi_gro_frags);
>
> --
> 2.19.1
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply
* Re: [PATCH bpf-next] bpftool: make libbfd optional
From: Stanislav Fomichev @ 2018-11-12 19:58 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: Stanislav Fomichev, netdev, ast, daniel, quentin.monnet
In-Reply-To: <20181112114234.48ef2e6b@cakuba.netronome.com>
On 11/12, Jakub Kicinski wrote:
> On Mon, 12 Nov 2018 10:53:28 -0800, Stanislav Fomichev wrote:
> > Make it possible to build bpftool without libbfd. This excludes support for
> > disassembling jit-ted code and prints an error if the user tries to use
> > these features.
> >
> > Tested by:
> > cat > FEATURES_DUMP.bpftool <<EOF
> > feature-libbfd=0
> > feature-disassembler-four-args=1
> > feature-reallocarray=0
> > feature-libelf=1
> > feature-libelf-mmap=1
> > feature-bpf=1
> > EOF
> > FEATURES_DUMP=$PWD/FEATURES_DUMP.bpftool make
> > ldd bpftool | grep libbfd
> >
> > Signed-off-by: Stanislav Fomichev <sdf@google.com>
>
> Would you mind spelling out the motivation?
Ack, will do in v2 commit message. tldr - some fleet machines don't
have dev/dbg stuff installed; would like an option to have bpftool that
works everywhere for introspection.
> > diff --git a/tools/bpf/bpftool/main.h b/tools/bpf/bpftool/main.h
> > index 61d82020af58..ec1bc2ae3c71 100644
> > --- a/tools/bpf/bpftool/main.h
> > +++ b/tools/bpf/bpftool/main.h
> > @@ -147,8 +147,19 @@ int prog_parse_fd(int *argc, char ***argv);
> > int map_parse_fd(int *argc, char ***argv);
> > int map_parse_fd_and_info(int *argc, char ***argv, void *info, __u32 *info_len);
> >
> > +#ifdef HAVE_LIBBFD_SUPPORT
> > void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
> > const char *arch, const char *disassembler_options);
> > +void disasm_init(void);
> > +#else
> > +static inline
> > +void disasm_print_insn(unsigned char *image, ssize_t len, int opcodes,
> > + const char *arch, const char *disassembler_options)
> > +{
> > + p_err("No libbfd support");
> > +}
>
> I think an error per instruction is a bit much, could we make sure we
> error out earlier?
I can return int from disasm_print_insn as an indication to
stop/continue. Let me know if you have better ideas, will post v2 later
today.
> > +static inline void disasm_init(void) {}
> > +#endif
> > void print_data_json(uint8_t *data, size_t len);
> > void print_hex_data_json(uint8_t *data, size_t len);
>
> Otherwise LGTM.
Thanks!
^ permalink raw reply
* [PATCH AUTOSEL 4.14 06/26] ixgbe: fix MAC anti-spoofing filter after VFLR
From: Sasha Levin @ 2018-11-13 5:51 UTC (permalink / raw)
To: stable, linux-kernel; +Cc: Radoslaw Tyl, Jeff Kirsher, Sasha Levin, netdev
In-Reply-To: <20181113055150.78773-1-sashal@kernel.org>
From: Radoslaw Tyl <radoslawx.tyl@intel.com>
[ Upstream commit 6702185c1ffec3421181b5e24491e3fac920cb61 ]
This change resolves a driver bug where the driver is logging a
message that says "Spoofed packets detected". This can occur on the PF
(host) when a VF has VLAN+MACVLAN enabled and is re-started with a
different MAC address.
MAC and VLAN anti-spoofing filters are to be enabled together.
Signed-off-by: Radoslaw Tyl <radoslawx.tyl@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Acked-by: Piotr Skajewski <piotrx.skajewski@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index 112d24c6c9ce..4904a63b83ef 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -760,8 +760,10 @@ static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf)
ixgbe_set_vmvir(adapter, vfinfo->pf_vlan,
adapter->default_up, vf);
- if (vfinfo->spoofchk_enabled)
+ if (vfinfo->spoofchk_enabled) {
hw->mac.ops.set_vlan_anti_spoofing(hw, true, vf);
+ hw->mac.ops.set_mac_anti_spoofing(hw, true, vf);
+ }
}
/* reset multicast table array for vf */
--
2.17.1
^ permalink raw reply related
* [PATCH AUTOSEL 4.18 10/39] ixgbe: fix MAC anti-spoofing filter after VFLR
From: Sasha Levin @ 2018-11-13 5:50 UTC (permalink / raw)
To: stable, linux-kernel; +Cc: Radoslaw Tyl, Jeff Kirsher, Sasha Levin, netdev
In-Reply-To: <20181113055053.78352-1-sashal@kernel.org>
From: Radoslaw Tyl <radoslawx.tyl@intel.com>
[ Upstream commit 6702185c1ffec3421181b5e24491e3fac920cb61 ]
This change resolves a driver bug where the driver is logging a
message that says "Spoofed packets detected". This can occur on the PF
(host) when a VF has VLAN+MACVLAN enabled and is re-started with a
different MAC address.
MAC and VLAN anti-spoofing filters are to be enabled together.
Signed-off-by: Radoslaw Tyl <radoslawx.tyl@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Acked-by: Piotr Skajewski <piotrx.skajewski@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index 2bc4fe475f28..23363bc92718 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -716,8 +716,10 @@ static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf)
ixgbe_set_vmvir(adapter, vfinfo->pf_vlan,
adapter->default_up, vf);
- if (vfinfo->spoofchk_enabled)
+ if (vfinfo->spoofchk_enabled) {
hw->mac.ops.set_vlan_anti_spoofing(hw, true, vf);
+ hw->mac.ops.set_mac_anti_spoofing(hw, true, vf);
+ }
}
/* reset multicast table array for vf */
--
2.17.1
^ permalink raw reply related
* [PATCH AUTOSEL 4.18 08/39] net: hns3: bugfix for rtnl_lock's range in the hclge_reset()
From: Sasha Levin @ 2018-11-13 5:50 UTC (permalink / raw)
To: stable, linux-kernel; +Cc: Huazhong Tan, David S . Miller, Sasha Levin, netdev
In-Reply-To: <20181113055053.78352-1-sashal@kernel.org>
From: Huazhong Tan <tanhuazhong@huawei.com>
[ Upstream commit a963052e539887df481d4d3a6ad4c92ca6461852 ]
Since hclge_reset_wait() is used to wait for the hardware to complete
the reset, it is not necessary to hold the rtnl_lock during
hclge_reset_wait(). So this patch releases the lock for the duration
of hclge_reset_wait().
Fixes: 6d4fab39533f ("net: hns3: Reset net device with rtnl_lock")
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 13f43b74fd6d..de85a31106e7 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -2827,14 +2827,17 @@ static void hclge_reset(struct hclge_dev *hdev)
/* perform reset of the stack & ae device for a client */
rtnl_lock();
hclge_notify_client(hdev, HNAE3_DOWN_CLIENT);
+ rtnl_unlock();
if (!hclge_reset_wait(hdev)) {
+ rtnl_lock();
hclge_notify_client(hdev, HNAE3_UNINIT_CLIENT);
hclge_reset_ae_dev(hdev->ae_dev);
hclge_notify_client(hdev, HNAE3_INIT_CLIENT);
hclge_clear_reset_cause(hdev);
} else {
+ rtnl_lock();
/* schedule again to check pending resets later */
set_bit(hdev->reset_type, &hdev->reset_pending);
hclge_reset_task_schedule(hdev);
--
2.17.1
^ permalink raw reply related
* [PATCH AUTOSEL 4.18 07/39] net: hns3: bugfix for rtnl_lock's range in the hclgevf_reset()
From: Sasha Levin @ 2018-11-13 5:50 UTC (permalink / raw)
To: stable, linux-kernel; +Cc: Huazhong Tan, David S . Miller, Sasha Levin, netdev
In-Reply-To: <20181113055053.78352-1-sashal@kernel.org>
From: Huazhong Tan <tanhuazhong@huawei.com>
[ Upstream commit 29118ab962d5476fdc65fae312ac38db68092d78 ]
Since hclgevf_reset_wait() is used to wait for the hardware to complete
the reset, it is not necessary to hold the rtnl_lock during
hclgevf_reset_wait(). So this patch releases the lock for the duration
of hclgevf_reset_wait().
Fixes: 6988eb2a9b77 ("net: hns3: Add support to reset the enet/ring mgmt layer")
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
index 12aa1f1b99ef..7e22853e5d2a 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
@@ -1052,6 +1052,8 @@ static int hclgevf_reset(struct hclgevf_dev *hdev)
/* bring down the nic to stop any ongoing TX/RX */
hclgevf_notify_client(hdev, HNAE3_DOWN_CLIENT);
+ rtnl_unlock();
+
/* check if VF could successfully fetch the hardware reset completion
* status from the hardware
*/
@@ -1063,12 +1065,15 @@ static int hclgevf_reset(struct hclgevf_dev *hdev)
ret);
dev_warn(&hdev->pdev->dev, "VF reset failed, disabling VF!\n");
+ rtnl_lock();
hclgevf_notify_client(hdev, HNAE3_UNINIT_CLIENT);
rtnl_unlock();
return ret;
}
+ rtnl_lock();
+
/* now, re-initialize the nic client and ae device*/
ret = hclgevf_reset_stack(hdev);
if (ret)
--
2.17.1
^ permalink raw reply related
* [PATCH AUTOSEL 4.19 12/44] ixgbe: fix MAC anti-spoofing filter after VFLR
From: Sasha Levin @ 2018-11-13 5:49 UTC (permalink / raw)
To: stable, linux-kernel; +Cc: Radoslaw Tyl, Jeff Kirsher, Sasha Levin, netdev
In-Reply-To: <20181113054950.77898-1-sashal@kernel.org>
From: Radoslaw Tyl <radoslawx.tyl@intel.com>
[ Upstream commit 6702185c1ffec3421181b5e24491e3fac920cb61 ]
This change resolves a driver bug where the driver is logging a
message that says "Spoofed packets detected". This can occur on the PF
(host) when a VF has VLAN+MACVLAN enabled and is re-started with a
different MAC address.
MAC and VLAN anti-spoofing filters are to be enabled together.
Signed-off-by: Radoslaw Tyl <radoslawx.tyl@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Acked-by: Piotr Skajewski <piotrx.skajewski@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index 3c6f01c41b78..eea63a99f29c 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -721,8 +721,10 @@ static inline void ixgbe_vf_reset_event(struct ixgbe_adapter *adapter, u32 vf)
ixgbe_set_vmvir(adapter, vfinfo->pf_vlan,
adapter->default_up, vf);
- if (vfinfo->spoofchk_enabled)
+ if (vfinfo->spoofchk_enabled) {
hw->mac.ops.set_vlan_anti_spoofing(hw, true, vf);
+ hw->mac.ops.set_mac_anti_spoofing(hw, true, vf);
+ }
}
/* reset multicast table array for vf */
--
2.17.1
^ permalink raw reply related
* [PATCH AUTOSEL 4.19 11/44] net: hns3: bugfix for the initialization of command queue's spin lock
From: Sasha Levin @ 2018-11-13 5:49 UTC (permalink / raw)
To: stable, linux-kernel; +Cc: Huazhong Tan, David S . Miller, Sasha Levin, netdev
In-Reply-To: <20181113054950.77898-1-sashal@kernel.org>
From: Huazhong Tan <tanhuazhong@huawei.com>
[ Upstream commit b2f74dbaf12bf59ff35d451005b3cdee78232ff0 ]
The spin lock of the command queue only need to be initialized once
when the driver initializes the command queue. It is not necessary to
initialize the spin lock when resetting. At the same time, the
modification of the queue member should be performed after acquiring
the lock.
Fixes: 3efb960f056d ("net: hns3: Refactor the initialization of command queue")
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c
index ac13cb2b168e..68026a5ad7e7 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.c
@@ -304,6 +304,10 @@ int hclge_cmd_queue_init(struct hclge_dev *hdev)
{
int ret;
+ /* Setup the lock for command queue */
+ spin_lock_init(&hdev->hw.cmq.csq.lock);
+ spin_lock_init(&hdev->hw.cmq.crq.lock);
+
/* Setup the queue entries for use cmd queue */
hdev->hw.cmq.csq.desc_num = HCLGE_NIC_CMQ_DESC_NUM;
hdev->hw.cmq.crq.desc_num = HCLGE_NIC_CMQ_DESC_NUM;
@@ -337,18 +341,20 @@ int hclge_cmd_init(struct hclge_dev *hdev)
u32 version;
int ret;
+ spin_lock_bh(&hdev->hw.cmq.csq.lock);
+ spin_lock_bh(&hdev->hw.cmq.crq.lock);
+
hdev->hw.cmq.csq.next_to_clean = 0;
hdev->hw.cmq.csq.next_to_use = 0;
hdev->hw.cmq.crq.next_to_clean = 0;
hdev->hw.cmq.crq.next_to_use = 0;
- /* Setup the lock for command queue */
- spin_lock_init(&hdev->hw.cmq.csq.lock);
- spin_lock_init(&hdev->hw.cmq.crq.lock);
-
hclge_cmd_init_regs(&hdev->hw);
clear_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state);
+ spin_unlock_bh(&hdev->hw.cmq.crq.lock);
+ spin_unlock_bh(&hdev->hw.cmq.csq.lock);
+
ret = hclge_cmd_query_firmware_version(&hdev->hw, &version);
if (ret) {
dev_err(&hdev->pdev->dev,
--
2.17.1
^ permalink raw reply related
* [PATCH AUTOSEL 4.19 10/44] net: hns3: bugfix for handling mailbox while the command queue reinitialized
From: Sasha Levin @ 2018-11-13 5:49 UTC (permalink / raw)
To: stable, linux-kernel; +Cc: Huazhong Tan, David S . Miller, Sasha Levin, netdev
In-Reply-To: <20181113054950.77898-1-sashal@kernel.org>
From: Huazhong Tan <tanhuazhong@huawei.com>
[ Upstream commit 3c88ed1d798da355859ca083d3884a16ce0841f2 ]
In a multi-core machine, the mailbox service and reset service
will be executed at the same time. The reset service will re-initialize
the command queue, before that, the mailbox handler can only get some
invalid messages.
The HCLGE_STATE_CMD_DISABLE flag means that the command queue is not
available and needs to be reinitialized. Therefore, when the mailbox
handler recognizes this flag, it should not process the command.
Fixes: dde1a86e93ca ("net: hns3: Add mailbox support to PF driver")
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
index f34851c91eb3..e08e82020402 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_mbx.c
@@ -458,6 +458,12 @@ void hclge_mbx_handler(struct hclge_dev *hdev)
/* handle all the mailbox requests in the queue */
while (!hclge_cmd_crq_empty(&hdev->hw)) {
+ if (test_bit(HCLGE_STATE_CMD_DISABLE, &hdev->state)) {
+ dev_warn(&hdev->pdev->dev,
+ "command queue needs re-initializing\n");
+ return;
+ }
+
desc = &crq->desc[crq->next_to_use];
req = (struct hclge_mbx_vf_to_pf_cmd *)desc->data;
--
2.17.1
^ permalink raw reply related
* [PATCH AUTOSEL 4.19 09/44] net: hns3: bugfix for rtnl_lock's range in the hclge_reset()
From: Sasha Levin @ 2018-11-13 5:49 UTC (permalink / raw)
To: stable, linux-kernel; +Cc: Huazhong Tan, David S . Miller, Sasha Levin, netdev
In-Reply-To: <20181113054950.77898-1-sashal@kernel.org>
From: Huazhong Tan <tanhuazhong@huawei.com>
[ Upstream commit a963052e539887df481d4d3a6ad4c92ca6461852 ]
Since hclge_reset_wait() is used to wait for the hardware to complete
the reset, it is not necessary to hold the rtnl_lock during
hclge_reset_wait(). So this patch releases the lock for the duration
of hclge_reset_wait().
Fixes: 6d4fab39533f ("net: hns3: Reset net device with rtnl_lock")
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index 8577dfc799ad..18056c08f62a 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -2799,14 +2799,17 @@ static void hclge_reset(struct hclge_dev *hdev)
handle = &hdev->vport[0].nic;
rtnl_lock();
hclge_notify_client(hdev, HNAE3_DOWN_CLIENT);
+ rtnl_unlock();
if (!hclge_reset_wait(hdev)) {
+ rtnl_lock();
hclge_notify_client(hdev, HNAE3_UNINIT_CLIENT);
hclge_reset_ae_dev(hdev->ae_dev);
hclge_notify_client(hdev, HNAE3_INIT_CLIENT);
hclge_clear_reset_cause(hdev);
} else {
+ rtnl_lock();
/* schedule again to check pending resets later */
set_bit(hdev->reset_type, &hdev->reset_pending);
hclge_reset_task_schedule(hdev);
--
2.17.1
^ permalink raw reply related
* [PATCH AUTOSEL 4.19 08/44] net: hns3: bugfix for rtnl_lock's range in the hclgevf_reset()
From: Sasha Levin @ 2018-11-13 5:49 UTC (permalink / raw)
To: stable, linux-kernel; +Cc: Huazhong Tan, David S . Miller, Sasha Levin, netdev
In-Reply-To: <20181113054950.77898-1-sashal@kernel.org>
From: Huazhong Tan <tanhuazhong@huawei.com>
[ Upstream commit 29118ab962d5476fdc65fae312ac38db68092d78 ]
Since hclgevf_reset_wait() is used to wait for the hardware to complete
the reset, it is not necessary to hold the rtnl_lock during
hclgevf_reset_wait(). So this patch releases the lock for the duration
of hclgevf_reset_wait().
Fixes: 6988eb2a9b77 ("net: hns3: Add support to reset the enet/ring mgmt layer")
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
index 9c0091f2addf..57958273945c 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
@@ -1062,6 +1062,8 @@ static int hclgevf_reset(struct hclgevf_dev *hdev)
/* bring down the nic to stop any ongoing TX/RX */
hclgevf_notify_client(hdev, HNAE3_DOWN_CLIENT);
+ rtnl_unlock();
+
/* check if VF could successfully fetch the hardware reset completion
* status from the hardware
*/
@@ -1073,12 +1075,15 @@ static int hclgevf_reset(struct hclgevf_dev *hdev)
ret);
dev_warn(&hdev->pdev->dev, "VF reset failed, disabling VF!\n");
+ rtnl_lock();
hclgevf_notify_client(hdev, HNAE3_UNINIT_CLIENT);
rtnl_unlock();
return ret;
}
+ rtnl_lock();
+
/* now, re-initialize the nic client and ae device*/
ret = hclgevf_reset_stack(hdev);
if (ret)
--
2.17.1
^ permalink raw reply related
* [PATCH AUTOSEL 4.19 07/44] bpf: fix partial copy of map_ptr when dst is scalar
From: Sasha Levin @ 2018-11-13 5:49 UTC (permalink / raw)
To: stable, linux-kernel
Cc: Daniel Borkmann, Edward Cree, Alexei Starovoitov, Sasha Levin,
netdev
In-Reply-To: <20181113054950.77898-1-sashal@kernel.org>
From: Daniel Borkmann <daniel@iogearbox.net>
[ Upstream commit 0962590e553331db2cc0aef2dc35c57f6300dbbe ]
ALU operations on pointers such as scalar_reg += map_value_ptr are
handled in adjust_ptr_min_max_vals(). Problem is however that map_ptr
and range in the register state share a union, so transferring state
through dst_reg->range = ptr_reg->range is just buggy as any new
map_ptr in the dst_reg is then truncated (or null) for subsequent
checks. Fix this by adding a raw member and use it for copying state
over to dst_reg.
Fixes: f1174f77b50c ("bpf/verifier: rework value tracking")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Cc: Edward Cree <ecree@solarflare.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
include/linux/bpf_verifier.h | 3 +++
kernel/bpf/verifier.c | 10 ++++++----
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/include/linux/bpf_verifier.h b/include/linux/bpf_verifier.h
index 38b04f559ad3..1fd6fa822d2c 100644
--- a/include/linux/bpf_verifier.h
+++ b/include/linux/bpf_verifier.h
@@ -50,6 +50,9 @@ struct bpf_reg_state {
* PTR_TO_MAP_VALUE_OR_NULL
*/
struct bpf_map *map_ptr;
+
+ /* Max size from any of the above. */
+ unsigned long raw;
};
/* Fixed part of pointer offset, pointer types only */
s32 off;
diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
index 465952a8e465..b046564cc18d 100644
--- a/kernel/bpf/verifier.c
+++ b/kernel/bpf/verifier.c
@@ -2762,7 +2762,7 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env,
dst_reg->umax_value = umax_ptr;
dst_reg->var_off = ptr_reg->var_off;
dst_reg->off = ptr_reg->off + smin_val;
- dst_reg->range = ptr_reg->range;
+ dst_reg->raw = ptr_reg->raw;
break;
}
/* A new variable offset is created. Note that off_reg->off
@@ -2792,10 +2792,11 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env,
}
dst_reg->var_off = tnum_add(ptr_reg->var_off, off_reg->var_off);
dst_reg->off = ptr_reg->off;
+ dst_reg->raw = ptr_reg->raw;
if (reg_is_pkt_pointer(ptr_reg)) {
dst_reg->id = ++env->id_gen;
/* something was added to pkt_ptr, set range to zero */
- dst_reg->range = 0;
+ dst_reg->raw = 0;
}
break;
case BPF_SUB:
@@ -2824,7 +2825,7 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env,
dst_reg->var_off = ptr_reg->var_off;
dst_reg->id = ptr_reg->id;
dst_reg->off = ptr_reg->off - smin_val;
- dst_reg->range = ptr_reg->range;
+ dst_reg->raw = ptr_reg->raw;
break;
}
/* A new variable offset is created. If the subtrahend is known
@@ -2850,11 +2851,12 @@ static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env,
}
dst_reg->var_off = tnum_sub(ptr_reg->var_off, off_reg->var_off);
dst_reg->off = ptr_reg->off;
+ dst_reg->raw = ptr_reg->raw;
if (reg_is_pkt_pointer(ptr_reg)) {
dst_reg->id = ++env->id_gen;
/* something was added to pkt_ptr, set range to zero */
if (smin_val < 0)
- dst_reg->range = 0;
+ dst_reg->raw = 0;
}
break;
case BPF_AND:
--
2.17.1
^ permalink raw reply related
* [PATCH v2] net: Add trace events for all receive exit points
From: Geneviève Bastien @ 2018-11-12 19:44 UTC (permalink / raw)
To: davem
Cc: netdev, Geneviève Bastien, Mathieu Desnoyers, Steven Rostedt,
Ingo Molnar
Trace events are already present for the receive entry points, to indicate
how the reception entered the stack.
This patch adds the corresponding exit trace events that will bound the
reception such that all events occurring between the entry and the exit
can be considered as part of the reception context. This greatly helps
for dependency and root cause analyses.
Without this, it is impossible to determine whether a sched_wakeup
event following a netif_receive_skb event is the result of the packet
reception or a simple coincidence after further processing by the
thread.
Signed-off-by: Geneviève Bastien <gbastien@versatic.net>
CC: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Steven Rostedt <rostedt@goodmis.org>
CC: Ingo Molnar <mingo@redhat.com>
CC: David S. Miller <davem@davemloft.net>
---
Changes in v2:
- Add the return value to tracepoints where applicable
- Verify if tracepoint is enabled before walking list in
netif_receive_skb_list
---
include/trace/events/net.h | 78 ++++++++++++++++++++++++++++++++++++++
net/core/dev.c | 38 ++++++++++++++++---
2 files changed, 110 insertions(+), 6 deletions(-)
diff --git a/include/trace/events/net.h b/include/trace/events/net.h
index 00aa72ce0e7c..cff1a7b9d0bb 100644
--- a/include/trace/events/net.h
+++ b/include/trace/events/net.h
@@ -117,6 +117,42 @@ DECLARE_EVENT_CLASS(net_dev_template,
__get_str(name), __entry->skbaddr, __entry->len)
)
+DECLARE_EVENT_CLASS(net_dev_template_return,
+
+ TP_PROTO(struct sk_buff *skb, int ret),
+
+ TP_ARGS(skb, ret),
+
+ TP_STRUCT__entry(
+ __field(void *, skbaddr)
+ __field(int, ret)
+ ),
+
+ TP_fast_assign(
+ __entry->skbaddr = skb;
+ __entry->ret = ret;
+ ),
+
+ TP_printk("skbaddr=%p ret=%d", __entry->skbaddr, __entry->ret)
+)
+
+DECLARE_EVENT_CLASS(net_dev_template_simple,
+
+ TP_PROTO(struct sk_buff *skb),
+
+ TP_ARGS(skb),
+
+ TP_STRUCT__entry(
+ __field(void *, skbaddr)
+ ),
+
+ TP_fast_assign(
+ __entry->skbaddr = skb;
+ ),
+
+ TP_printk("skbaddr=%p", __entry->skbaddr)
+)
+
DEFINE_EVENT(net_dev_template, net_dev_queue,
TP_PROTO(struct sk_buff *skb),
@@ -244,6 +280,48 @@ DEFINE_EVENT(net_dev_rx_verbose_template, netif_rx_ni_entry,
TP_ARGS(skb)
);
+DEFINE_EVENT(net_dev_template_return, napi_gro_frags_exit,
+
+ TP_PROTO(struct sk_buff *skb, int ret),
+
+ TP_ARGS(skb, ret)
+);
+
+DEFINE_EVENT(net_dev_template_return, napi_gro_receive_exit,
+
+ TP_PROTO(struct sk_buff *skb, int ret),
+
+ TP_ARGS(skb, ret)
+);
+
+DEFINE_EVENT(net_dev_template_return, netif_receive_skb_exit,
+
+ TP_PROTO(struct sk_buff *skb, int ret),
+
+ TP_ARGS(skb, ret)
+);
+
+DEFINE_EVENT(net_dev_template_simple, netif_receive_skb_list_exit,
+
+ TP_PROTO(struct sk_buff *skb),
+
+ TP_ARGS(skb)
+);
+
+DEFINE_EVENT(net_dev_template_return, netif_rx_exit,
+
+ TP_PROTO(struct sk_buff *skb, int ret),
+
+ TP_ARGS(skb, ret)
+);
+
+DEFINE_EVENT(net_dev_template_return, netif_rx_ni_exit,
+
+ TP_PROTO(struct sk_buff *skb, int ret),
+
+ TP_ARGS(skb, ret)
+);
+
#endif /* _TRACE_NET_H */
/* This part must be outside protection */
diff --git a/net/core/dev.c b/net/core/dev.c
index 0ffcbdd55fa9..c4dc5df34abe 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4520,9 +4520,14 @@ static int netif_rx_internal(struct sk_buff *skb)
int netif_rx(struct sk_buff *skb)
{
+ int ret;
+
trace_netif_rx_entry(skb);
- return netif_rx_internal(skb);
+ ret = netif_rx_internal(skb);
+ trace_netif_rx_exit(skb, ret);
+
+ return ret;
}
EXPORT_SYMBOL(netif_rx);
@@ -4537,6 +4542,7 @@ int netif_rx_ni(struct sk_buff *skb)
if (local_softirq_pending())
do_softirq();
preempt_enable();
+ trace_netif_rx_ni_exit(skb, err);
return err;
}
@@ -5222,9 +5228,14 @@ static void netif_receive_skb_list_internal(struct list_head *head)
*/
int netif_receive_skb(struct sk_buff *skb)
{
+ int ret;
+
trace_netif_receive_skb_entry(skb);
- return netif_receive_skb_internal(skb);
+ ret = netif_receive_skb_internal(skb);
+ trace_netif_receive_skb_exit(skb, ret);
+
+ return ret;
}
EXPORT_SYMBOL(netif_receive_skb);
@@ -5244,9 +5255,15 @@ void netif_receive_skb_list(struct list_head *head)
if (list_empty(head))
return;
- list_for_each_entry(skb, head, list)
- trace_netif_receive_skb_list_entry(skb);
+ if (trace_netif_receive_skb_list_entry_enabled()) {
+ list_for_each_entry(skb, head, list)
+ trace_netif_receive_skb_list_entry(skb);
+ }
netif_receive_skb_list_internal(head);
+ if (trace_netif_receive_skb_list_exit_enabled()) {
+ list_for_each_entry(skb, head, list)
+ trace_netif_receive_skb_list_exit(skb);
+ }
}
EXPORT_SYMBOL(netif_receive_skb_list);
@@ -5634,12 +5651,17 @@ static gro_result_t napi_skb_finish(gro_result_t ret, struct sk_buff *skb)
gro_result_t napi_gro_receive(struct napi_struct *napi, struct sk_buff *skb)
{
+ gro_result_t ret;
+
skb_mark_napi_id(skb, napi);
trace_napi_gro_receive_entry(skb);
skb_gro_reset_offset(skb);
- return napi_skb_finish(dev_gro_receive(napi, skb), skb);
+ ret = napi_skb_finish(dev_gro_receive(napi, skb), skb);
+ trace_napi_gro_receive_exit(skb, ret);
+
+ return ret;
}
EXPORT_SYMBOL(napi_gro_receive);
@@ -5753,6 +5775,7 @@ static struct sk_buff *napi_frags_skb(struct napi_struct *napi)
gro_result_t napi_gro_frags(struct napi_struct *napi)
{
+ gro_result_t ret;
struct sk_buff *skb = napi_frags_skb(napi);
if (!skb)
@@ -5760,7 +5783,10 @@ gro_result_t napi_gro_frags(struct napi_struct *napi)
trace_napi_gro_frags_entry(skb);
- return napi_frags_finish(napi, skb, dev_gro_receive(napi, skb));
+ ret = napi_frags_finish(napi, skb, dev_gro_receive(napi, skb));
+ trace_napi_gro_frags_exit(skb, ret);
+
+ return ret;
}
EXPORT_SYMBOL(napi_gro_frags);
--
2.19.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox