* Re: [Intel-wired-lan] [PATCH net-next v2 05/13] ice: Fix RDMA latency issue by allowing write-combining
[not found] ` <20230119011653.311675-6-jacob.e.keller@intel.com>
@ 2023-01-30 10:03 ` Alexander Lobakin
2023-01-30 23:34 ` Keller, Jacob E
0 siblings, 1 reply; 3+ messages in thread
From: Alexander Lobakin @ 2023-01-30 10:03 UTC (permalink / raw)
To: Jacob Keller; +Cc: Intel Wired LAN, Anthony Nguyen, Pavan Kumar Linga, netdev
From: Jacob Keller <jacob.e.keller@intel.com>
Date: Wed, 18 Jan 2023 17:16:45 -0800
> The current method of mapping the entire BAR region as a single uncacheable
> region does not allow RDMA to use write combining (WC). This results in
> increased latency with RDMA.
>
> To fix this, we initially planned to reduce the size of the map made by the
> PF driver to include only up to the beginning of the RDMA space.
> Unfortunately this will not work in the future as there are some hardware
> features which use registers beyond the RDMA area. This includes Scalable
> IOV, a virtualization feature being worked on currently.
>
> Instead of simply reducing the size of the map, we need a solution which
> will allow access to all areas of the address space while leaving the RDMA
> area open to be mapped with write combining.
>
> To allow for this, and fix the RMDA latency issue without blocking the
> higher areas of the BAR, we need to create multiple separate memory maps.
> Doing so will create a sparse mapping rather than a contiguous single area.
>
> Replace the void *hw_addr with a special ice_hw_addr structure which
> represents the multiple mappings as a flexible array.
>
> Based on the available BAR size, map up to 3 regions:
>
> * The space before the RDMA section
> * The RDMA section which wants write combining behavior
> * The space after the RDMA section
Please don't.
You have[0]:
* io_mapping_init_wc() (+ io_mapping_fini());
* io_mapping_create_wc() (+ io_mapping_free());
^ they do the same (the second just allocates a struct ad-hoc, but it
can be allocated manually or embedded into a driver structure),
* arch_phys_wc_add() (+ arch_phys_wc_del())[1];
^ optional to make MTRR happy
-- precisely for the case when you need to remap *a part* of BAR in a
different mode.
Splitting BARs, dropping pcim_iomap_regions() and so on, is very wrong.
Not speaking of that it's PCI driver which must own and map all the
memory the device advertises in its PCI config space, and in case of
ice, PCI driver is combined with Ethernet, so it's ice which must own
and map all the memory.
Not speaking of that using a structure with a flex array and creating a
static inline to calculate the pointer each time you need to read/write
a register, hurts performance and looks properly ugly.
The interfaces above must be used by the RDMA driver, right before
mapping its part in WC mode. PCI driver has no idea that someone else
wants to remap its memory differently, so the code doesn't belong here.
I'd drop the patch and let the RDMA team fix/improve their driver.
>
> Add an ice_get_hw_addr function which converts a register offset into the
> appropriate kernel address based on which chunk it falls into. This does
> cost us slightly more computation overhead for register access as we now
> must check the table each access. However, we can pre-compute the addresses
> where this would most be a problem.
>
> With this change, the RDMA driver is now free to map the RDMA register
> section as write-combined without impacting access to other device
> registers used by the main PF driver.
>
> Reported-by: Dave Ertman <david.m.ertman@intel.com>
> Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
> ---
> Changes since v1:
> * Export ice_get_hw_addr
> * Use ice_get_hw_addr in iRDMA driver
> * Fix the WARN_ON to use %pa instead of %llx for printing a resource_size_t
>
> drivers/infiniband/hw/irdma/main.c | 2 +-
> drivers/net/ethernet/intel/ice/ice.h | 4 +-
> drivers/net/ethernet/intel/ice/ice_base.c | 5 +-
> drivers/net/ethernet/intel/ice/ice_ethtool.c | 3 +-
> drivers/net/ethernet/intel/ice/ice_main.c | 177 +++++++++++++++++--
> drivers/net/ethernet/intel/ice/ice_osdep.h | 48 ++++-
> drivers/net/ethernet/intel/ice/ice_txrx.h | 2 +-
> drivers/net/ethernet/intel/ice/ice_type.h | 2 +-
> 8 files changed, 219 insertions(+), 24 deletions(-)
[0]
https://elixir.bootlin.com/linux/v6.2-rc6/source/include/linux/io-mapping.h#L42
[1]
https://elixir.bootlin.com/linux/v6.2-rc6/source/arch/x86/include/asm/io.h#L339
Thanks,
Olek
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [Intel-wired-lan] [PATCH net-next v2 05/13] ice: Fix RDMA latency issue by allowing write-combining
2023-01-30 10:03 ` [Intel-wired-lan] [PATCH net-next v2 05/13] ice: Fix RDMA latency issue by allowing write-combining Alexander Lobakin
@ 2023-01-30 23:34 ` Keller, Jacob E
2023-01-31 0:26 ` Tony Nguyen
0 siblings, 1 reply; 3+ messages in thread
From: Keller, Jacob E @ 2023-01-30 23:34 UTC (permalink / raw)
To: Lobakin, Alexandr, Nguyen, Anthony L, Dave.Ertman@intel.com,
Saleem, Shiraz
Cc: Intel Wired LAN, Linga, Pavan Kumar, netdev@vger.kernel.org
> -----Original Message-----
> From: Lobakin, Alexandr <alexandr.lobakin@intel.com>
> Sent: Monday, January 30, 2023 2:03 AM
> To: Keller, Jacob E <jacob.e.keller@intel.com>
> Cc: Intel Wired LAN <intel-wired-lan@lists.osuosl.org>; Nguyen, Anthony L
> <anthony.l.nguyen@intel.com>; Linga, Pavan Kumar
> <pavan.kumar.linga@intel.com>; netdev@vger.kernel.org
> Subject: Re: [Intel-wired-lan] [PATCH net-next v2 05/13] ice: Fix RDMA latency
> issue by allowing write-combining
>
> From: Jacob Keller <jacob.e.keller@intel.com>
> Date: Wed, 18 Jan 2023 17:16:45 -0800
>
> > The current method of mapping the entire BAR region as a single uncacheable
> > region does not allow RDMA to use write combining (WC). This results in
> > increased latency with RDMA.
> >
> > To fix this, we initially planned to reduce the size of the map made by the
> > PF driver to include only up to the beginning of the RDMA space.
> > Unfortunately this will not work in the future as there are some hardware
> > features which use registers beyond the RDMA area. This includes Scalable
> > IOV, a virtualization feature being worked on currently.
> >
> > Instead of simply reducing the size of the map, we need a solution which
> > will allow access to all areas of the address space while leaving the RDMA
> > area open to be mapped with write combining.
> >
> > To allow for this, and fix the RMDA latency issue without blocking the
> > higher areas of the BAR, we need to create multiple separate memory maps.
> > Doing so will create a sparse mapping rather than a contiguous single area.
> >
> > Replace the void *hw_addr with a special ice_hw_addr structure which
> > represents the multiple mappings as a flexible array.
> >
> > Based on the available BAR size, map up to 3 regions:
> >
> > * The space before the RDMA section
> > * The RDMA section which wants write combining behavior
> > * The space after the RDMA section
>
> Please don't.
>
> You have[0]:
>
> * io_mapping_init_wc() (+ io_mapping_fini());
> * io_mapping_create_wc() (+ io_mapping_free());
>
> ^ they do the same (the second just allocates a struct ad-hoc, but it
> can be allocated manually or embedded into a driver structure),
>
> * arch_phys_wc_add() (+ arch_phys_wc_del())[1];
>
> ^ optional to make MTRR happy
>
> -- precisely for the case when you need to remap *a part* of BAR in a
> different mode.
>
> Splitting BARs, dropping pcim_iomap_regions() and so on, is very wrong.
> Not speaking of that it's PCI driver which must own and map all the
> memory the device advertises in its PCI config space, and in case of
> ice, PCI driver is combined with Ethernet, so it's ice which must own
> and map all the memory.
> Not speaking of that using a structure with a flex array and creating a
> static inline to calculate the pointer each time you need to read/write
> a register, hurts performance and looks properly ugly.
>
> The interfaces above must be used by the RDMA driver, right before
> mapping its part in WC mode. PCI driver has no idea that someone else
> wants to remap its memory differently, so the code doesn't belong here.
> I'd drop the patch and let the RDMA team fix/improve their driver.
>
Appreciate the review! I proposed this option after the original change was to simply reduce the initial size of our bar mapping, resulting in losing access to the registers beyond the RDMA section, which was a non-starter for us once we finish implementing Scalable IOV support.
Searching for io_mapping_init_wc and io_mapping_create_wc there are only a handful of users and not much documentation so no wonder I had trouble locating it! Thanks for helping me learn about it.
@Dave.Ertman@intel.com, @Saleem, Shiraz it looks like we need to drop this patch and modify the iRDMA driver's method of requesting write combined regions to use these new interfaces.
@Nguyen, Anthony L Can you drop this patch from the series on IWL or should I send a v3?
Thanks,
Jake
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Intel-wired-lan] [PATCH net-next v2 05/13] ice: Fix RDMA latency issue by allowing write-combining
2023-01-30 23:34 ` Keller, Jacob E
@ 2023-01-31 0:26 ` Tony Nguyen
0 siblings, 0 replies; 3+ messages in thread
From: Tony Nguyen @ 2023-01-31 0:26 UTC (permalink / raw)
To: Keller, Jacob E, Lobakin, Alexandr, Dave.Ertman@intel.com,
Saleem, Shiraz
Cc: Intel Wired LAN, Linga, Pavan Kumar, netdev@vger.kernel.org
On 1/30/2023 3:34 PM, Keller, Jacob E wrote:
>
> @Nguyen, Anthony L Can you drop this patch from the series on IWL or should I send a v3?
It looks like it cleanly drops out of the series; I can take care of it,
no need for v3.
Thanks,
Tony
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-01-31 0:26 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20230119011653.311675-1-jacob.e.keller@intel.com>
[not found] ` <20230119011653.311675-6-jacob.e.keller@intel.com>
2023-01-30 10:03 ` [Intel-wired-lan] [PATCH net-next v2 05/13] ice: Fix RDMA latency issue by allowing write-combining Alexander Lobakin
2023-01-30 23:34 ` Keller, Jacob E
2023-01-31 0:26 ` Tony Nguyen
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).