All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron via <qemu-devel@nongnu.org>
To: Gao Shiyuan via <qemu-devel@nongnu.org>
Cc: Gao Shiyuan <gaoshiyuan@baidu.com>, <eduardo@habkost.net>,
	<marcel.apfelbaum@gmail.com>, <mst@redhat.com>,
	<zhao1.liu@intel.com>
Subject: Re: [PATCH 1/1] pcie-root-port: Fast PCIe root ports for new machine
Date: Mon, 18 Nov 2024 11:43:20 +0000	[thread overview]
Message-ID: <20241118114320.00002d12@huawei.com> (raw)
In-Reply-To: <20241117143917.41403-1-gaoshiyuan@baidu.com>

On Sun, 17 Nov 2024 22:39:17 +0800
Gao Shiyuan via <qemu-devel@nongnu.org> wrote:

> Some hardware devices now support PCIe 5.0, so change the default
> speed of the PCIe root port on new machine types.
> 
> For passthrough Nvidia H20, this will be able to increase the h2d/d2h
> bandwidth ~17%.

I'm curious.  Why are you seeing the perf improvement?

Maybe my mental model is wrong, but I though we just faked these
registers so there should be no actual change of the link speed
just a change in what the guest sees.   Is the driver using this
information to tune something else?

I recently added support for the equivalent to CXL port emulation
to support performance characteristic discovery but so far I think
that's only informational for userspace software rather than affecting
hardware usage directly.

Jonathan

> 
> Origin:
> [CUDA Bandwidth Test] - Starting...
> Running on...
> 
>  Device 0: NVIDIA H20
>  Quick Mode
> 
>  Host to Device Bandwidth, 1 Device(s)
>  PINNED Memory Transfers
>    Transfer Size (Bytes)    Bandwidth(MB/s)
>    33554432            45915.4
> 
>  Device to Host Bandwidth, 1 Device(s)
>  PINNED Memory Transfers
>    Transfer Size (Bytes)    Bandwidth(MB/s)
>    33554432            45980.3
> 
>  Device to Device Bandwidth, 1 Device(s)
>  PINNED Memory Transfers
>    Transfer Size (Bytes)    Bandwidth(MB/s)
>    33554432            1842886.8
> 
> Result = PASS
> 
> With this patch:
> [CUDA Bandwidth Test] - Starting...
> Running on...
> 
>  Device 0: NVIDIA H20
>  Quick Mode
> 
>  Host to Device Bandwidth, 1 Device(s)
>  PINNED Memory Transfers
>    Transfer Size (Bytes)	Bandwidth(MB/s)
>    33554432			53682.0
> 
>  Device to Host Bandwidth, 1 Device(s)
>  PINNED Memory Transfers
>    Transfer Size (Bytes)	Bandwidth(MB/s)
>    33554432			53766.0
> 
>  Device to Device Bandwidth, 1 Device(s)
>  PINNED Memory Transfers
>    Transfer Size (Bytes)	Bandwidth(MB/s)
>    33554432			1842555.1
> 
> Result = PASS
> 
> Signed-off-by: Gao Shiyuan <gaoshiyuan@baidu.com>
> ---
>  hw/core/machine.c                  | 1 +
>  hw/pci-bridge/gen_pcie_root_port.c | 2 +-
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/hw/core/machine.c b/hw/core/machine.c
> index a35c4a8fae..afef55626d 100644
> --- a/hw/core/machine.c
> +++ b/hw/core/machine.c
> @@ -38,6 +38,7 @@
>  
>  GlobalProperty hw_compat_9_1[] = {
>      { TYPE_PCI_DEVICE, "x-pcie-ext-tag", "false" },
> +    { "pcie-root-port", "x-speed", "16" },
>  };
>  const size_t hw_compat_9_1_len = G_N_ELEMENTS(hw_compat_9_1);
>  
> diff --git a/hw/pci-bridge/gen_pcie_root_port.c b/hw/pci-bridge/gen_pcie_root_port.c
> index 784507c826..c24ce1f2d1 100644
> --- a/hw/pci-bridge/gen_pcie_root_port.c
> +++ b/hw/pci-bridge/gen_pcie_root_port.c
> @@ -142,7 +142,7 @@ static Property gen_rp_props[] = {
>      DEFINE_PROP_SIZE("pref64-reserve", GenPCIERootPort,
>                       res_reserve.mem_pref_64, -1),
>      DEFINE_PROP_PCIE_LINK_SPEED("x-speed", PCIESlot,
> -                                speed, PCIE_LINK_SPEED_16),
> +                                speed, PCIE_LINK_SPEED_32),
>      DEFINE_PROP_PCIE_LINK_WIDTH("x-width", PCIESlot,
>                                  width, PCIE_LINK_WIDTH_32),
>      DEFINE_PROP_END_OF_LIST()



  reply	other threads:[~2024-11-18 11:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-17 14:39 [PATCH 1/1] pcie-root-port: Fast PCIe root ports for new machine Gao Shiyuan via
2024-11-18 11:43 ` Jonathan Cameron via [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-12-03 10:58 Gao,Shiyuan via
2024-12-03 11:08 ` Daniel P. Berrangé
2024-12-03 12:15 Gao,Shiyuan via
2024-12-03 12:20 Gao,Shiyuan via

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=20241118114320.00002d12@huawei.com \
    --to=qemu-devel@nongnu.org \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=eduardo@habkost.net \
    --cc=gaoshiyuan@baidu.com \
    --cc=marcel.apfelbaum@gmail.com \
    --cc=mst@redhat.com \
    --cc=zhao1.liu@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.