From: Jesper Dangaard Brouer <brouer@redhat.com>
To: Jakub Kicinski <jakub.kicinski@netronome.com>
Cc: Saeed Mahameed <saeedm@mellanox.com>,
Tariq Toukan <tariqt@mellanox.com>,
"David S. Miller" <davem@davemloft.net>,
netdev@vger.kernel.org, Jonathan Lemon <bsd@fb.com>,
brouer@redhat.com, Alexander Duyck <alexander.duyck@gmail.com>
Subject: Re: [net-next 01/14] net/mlx5e: RX, Add a prefetch command for small L1_CACHE_BYTES
Date: Tue, 23 Apr 2019 15:23:41 +0200 [thread overview]
Message-ID: <20190423152341.66a912b8@carbon> (raw)
In-Reply-To: <20190422194647.372fd817@cakuba.netronome.com>
On Mon, 22 Apr 2019 19:46:47 -0700
Jakub Kicinski <jakub.kicinski@netronome.com> wrote:
> On Mon, 22 Apr 2019 15:32:53 -0700, Saeed Mahameed wrote:
> > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en.h b/drivers/net/ethernet/mellanox/mlx5/core/en.h
> > index 51e109fdeec1..6147be23a9b9 100644
> > --- a/drivers/net/ethernet/mellanox/mlx5/core/en.h
> > +++ b/drivers/net/ethernet/mellanox/mlx5/core/en.h
> > @@ -50,6 +50,7 @@
> > #include <net/xdp.h>
> > #include <linux/net_dim.h>
> > #include <linux/bits.h>
> > +#include <linux/prefetch.h>
> > #include "wq.h"
> > #include "mlx5_core.h"
> > #include "en_stats.h"
> > @@ -986,6 +987,22 @@ static inline void mlx5e_cq_arm(struct mlx5e_cq *cq)
> > mlx5_cq_arm(mcq, MLX5_CQ_DB_REQ_NOT, mcq->uar->map, cq->wq.cc);
> > }
> >
> > +static inline void mlx5e_prefetch(void *p)
> > +{
> > + prefetch(p);
> > +#if L1_CACHE_BYTES < 128
> > + prefetch(p + L1_CACHE_BYTES);
> > +#endif
> > +}
> > +
> > +static inline void mlx5e_prefetchw(void *p)
> > +{
> > + prefetchw(p);
> > +#if L1_CACHE_BYTES < 128
> > + prefetchw(p + L1_CACHE_BYTES);
> > +#endif
> > +}
>
> All Intel drivers do the exact same thing, perhaps it's time to add a
> helper fot this?
>
> net_prefetch_headers()
>
> or some such?
I wonder if Tariq measured any effect from doing this?
Because Intel CPUs will usually already prefetch the next cache-line,
as described in [1], you can even read (and modify) this MSR 0x1A4
e.g. via tools in [2]. Maybe Intel guys added it before this was done
in HW, and never cleaned it up?
[1] https://software.intel.com/en-us/articles/disclosure-of-hw-prefetcher-control-on-some-intel-processors
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer
[2] http://www.kernel.org/pub/linux/utils/cpu/msr-tools/
next prev parent reply other threads:[~2019-04-23 13:23 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-22 22:32 [pull request][net-next 00/14] Mellanox, mlx5 RX and XDP improvements Saeed Mahameed
2019-04-22 22:32 ` [net-next 01/14] net/mlx5e: RX, Add a prefetch command for small L1_CACHE_BYTES Saeed Mahameed
2019-04-23 2:46 ` Jakub Kicinski
2019-04-23 13:23 ` Jesper Dangaard Brouer [this message]
2019-04-23 15:21 ` Alexander Duyck
2019-04-23 16:42 ` Saeed Mahameed
2019-04-23 17:27 ` Alexander Duyck
2019-04-23 18:24 ` Jesper Dangaard Brouer
2019-04-23 18:46 ` Saeed Mahameed
2019-04-23 20:12 ` Alexander Duyck
2019-04-22 22:32 ` [net-next 02/14] net/mlx5e: RX, Support multiple outstanding UMR posts Saeed Mahameed
2019-04-22 22:32 ` [net-next 03/14] net/mlx5e: XDP, Fix shifted flag index in RQ bitmap Saeed Mahameed
2019-04-22 22:32 ` [net-next 04/14] net/mlx5e: XDP, Enhance RQ indication for XDP redirect flush Saeed Mahameed
2019-04-22 22:32 ` [net-next 05/14] net/mlx5e: XDP, Add TX MPWQE session counter Saeed Mahameed
2019-04-22 22:32 ` [net-next 06/14] net/mlx5e: XDP, Inline small packets into the TX MPWQE in XDP xmit flow Saeed Mahameed
2019-04-23 12:53 ` Gal Pressman
2019-04-23 16:46 ` Saeed Mahameed
2019-04-22 22:32 ` [net-next 07/14] net/mlx5e: Remove unused parameter Saeed Mahameed
2019-04-22 22:33 ` [net-next 08/14] net/mlx5e: Report mlx5e_xdp_set errors Saeed Mahameed
2019-04-22 22:33 ` [net-next 09/14] net/mlx5e: Move parameter calculation functions to en/params.c Saeed Mahameed
2019-04-22 22:33 ` [net-next 10/14] net/mlx5e: Add an underflow warning comment Saeed Mahameed
2019-04-22 22:33 ` [net-next 11/14] net/mlx5e: Remove unused parameter Saeed Mahameed
2019-04-22 22:33 ` [net-next 12/14] net/mlx5e: Take HW interrupt trigger into a function Saeed Mahameed
2019-04-22 22:33 ` [net-next 13/14] net/mlx5e: Remove unused rx_page_reuse stat Saeed Mahameed
2019-04-22 22:33 ` [net-next 14/14] net/mlx5e: Use #define for the WQE wait timeout constant Saeed Mahameed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190423152341.66a912b8@carbon \
--to=brouer@redhat.com \
--cc=alexander.duyck@gmail.com \
--cc=bsd@fb.com \
--cc=davem@davemloft.net \
--cc=jakub.kicinski@netronome.com \
--cc=netdev@vger.kernel.org \
--cc=saeedm@mellanox.com \
--cc=tariqt@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).