<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
Mhm, that sucks. Could we have the automated builds check for
paddings in the UAPi data structure?<br>
<br>
Christian.<br>
<br>
<div class="moz-cite-prefix">Am 14.01.23 um 00:33 schrieb Marek
Olšák:<br>
</div>
<blockquote type="cite" cite="mid:CAAxE2A5xivt_4PK2uEkVS_v08viJVJP9E39DfTb4VsVCvDMkTw@mail.gmail.com">
<div dir="ltr">
<div>There is no hole on 32-bit unfortunately. It looks like the
hole on 64-bit is now ABI.</div>
<div><br>
</div>
<div>I moved the field to replace _pad1. The patch is attached
(with your Rb).</div>
<div><br>
</div>
<div>Marek</div>
<div dir="ltr"><br>
</div>
<div dir="ltr">On Fri, Jan 13, 2023 at 4:20 PM Alex Deucher <<a href="mailto:alexdeucher@gmail.com" moz-do-not-send="true" class="moz-txt-link-freetext">alexdeucher@gmail.com</a>>
wrote:<br>
</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">On Fri, Jan 13, 2023 at
4:02 PM Marek Olšák <<a href="mailto:maraeo@gmail.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">maraeo@gmail.com</a>>
wrote:<br>
><br>
> i've added the comments and indeed pahole shows the
hole as expected.<br>
<br>
What about on 32-bit?<br>
<br>
Alex<br>
<br>
><br>
> Marek<br>
><br>
> On Thu, Jan 12, 2023 at 11:44 AM Alex Deucher <<a href="mailto:alexdeucher@gmail.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">alexdeucher@gmail.com</a>>
wrote:<br>
>><br>
>> On Thu, Jan 12, 2023 at 6:50 AM Christian König<br>
>> <<a href="mailto:christian.koenig@amd.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">christian.koenig@amd.com</a>>
wrote:<br>
>> ><br>
>> > Am 11.01.23 um 21:48 schrieb Alex Deucher:<br>
>> > > On Wed, Jan 4, 2023 at 3:17 PM Marek
Olšák <<a href="mailto:maraeo@gmail.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">maraeo@gmail.com</a>>
wrote:<br>
>> > >> Yes, it's meant to be like a spec
sheet. We are not interested in the current bandwidth
utilization.<br>
>> > > After chatting with Marek on IRC and
thinking about this more, I think<br>
>> > > this patch is fine. It's not really
meant for bandwidth per se, but<br>
>> > > rather as a limit to determine what the
driver should do in certain<br>
>> > > cases (i.e., when does it make sense to
copy to vram vs not). It's<br>
>> > > not straightforward for userspace to
parse the full topology to<br>
>> > > determine what links may be slow. I
guess one potential pitfall would<br>
>> > > be that if you pass the device into a VM,
the driver may report the<br>
>> > > wrong values. Generally in a VM the VM
doesn't get the full view up<br>
>> > > to the root port. I don't know if the
hypervisors report properly for<br>
>> > > pcie_bandwidth_available() in a VM or if
it just shows the info about<br>
>> > > the endpoint in the VM.<br>
>> ><br>
>> > So this basically doesn't return the gen and
lanes of the device, but<br>
>> > rather what was negotiated between the device
and the upstream root port?<br>
>><br>
>> Correct. It exposes the max gen and lanes of the
slowest link between<br>
>> the device and the root port.<br>
>><br>
>> ><br>
>> > If I got that correctly then we should
probably document that cause<br>
>> > otherwise somebody will try to "fix" it at
some time.<br>
>><br>
>> Good point.<br>
>><br>
>> Alex<br>
>><br>
>> ><br>
>> > Christian.<br>
>> ><br>
>> > ><br>
>> > > Reviewed-by: Alex Deucher <<a href="mailto:alexander.deucher@amd.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">alexander.deucher@amd.com</a>><br>
>> > ><br>
>> > > Alex<br>
>> > ><br>
>> > >> Marek<br>
>> > >><br>
>> > >> On Wed, Jan 4, 2023 at 10:33 AM
Lazar, Lijo <<a href="mailto:Lijo.Lazar@amd.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">Lijo.Lazar@amd.com</a>>
wrote:<br>
>> > >>> [AMD Official Use Only - General]<br>
>> > >>><br>
>> > >>><br>
>> > >>> To clarify, with DPM in place,
the current bandwidth will be changing based on the load.<br>
>> > >>><br>
>> > >>> If apps/umd already has a way to
know the current bandwidth utilisation, then possible
maximum also could be part of the same API. Otherwise, this
only looks like duplicate information. We have the same
information in sysfs DPM nodes.<br>
>> > >>><br>
>> > >>> BTW, I don't know to what extent
app/umd really makes use of this. Take that memory frequency
as an example (I'm reading it as 16GHz). It only looks like
a spec sheet.<br>
>> > >>><br>
>> > >>> Thanks,<br>
>> > >>> Lijo<br>
>> > >>> ________________________________<br>
>> > >>> From: Marek Olšák <<a href="mailto:maraeo@gmail.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">maraeo@gmail.com</a>><br>
>> > >>> Sent: Wednesday, January 4, 2023
8:40:00 PM<br>
>> > >>> To: Lazar, Lijo <<a href="mailto:Lijo.Lazar@amd.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">Lijo.Lazar@amd.com</a>><br>
>> > >>> Cc: <a href="mailto:amd-gfx@lists.freedesktop.org" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">amd-gfx@lists.freedesktop.org</a>
<<a href="mailto:amd-gfx@lists.freedesktop.org" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">amd-gfx@lists.freedesktop.org</a>><br>
>> > >>> Subject: Re: [PATCH 1/2]
drm/amdgpu: return the PCIe gen and lanes from the INFO<br>
>> > >>><br>
>> > >>> On Wed, Jan 4, 2023 at 9:19 AM
Lazar, Lijo <<a href="mailto:lijo.lazar@amd.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">lijo.lazar@amd.com</a>>
wrote:<br>
>> > >>><br>
>> > >>><br>
>> > >>><br>
>> > >>> On 1/4/2023 7:43 PM, Marek Olšák
wrote:<br>
>> > >>>> On Wed, Jan 4, 2023 at 6:50
AM Lazar, Lijo <<a href="mailto:lijo.lazar@amd.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">lijo.lazar@amd.com</a><br>
>> > >>>> <mailto:<a href="mailto:lijo.lazar@amd.com" target="_blank" moz-do-not-send="true" class="moz-txt-link-freetext">lijo.lazar@amd.com</a>>>
wrote:<br>
>> > >>>><br>
>> > >>>><br>
>> > >>>><br>
>> > >>>> On 1/4/2023 4:11 AM,
Marek Olšák wrote:<br>
>> > >>>> > I see. Well, those
sysfs files are not usable, and I don't think it<br>
>> > >>>> > would be important
even if they were usable, but for completeness:<br>
>> > >>>> ><br>
>> > >>>> > The ioctl returns:<br>
>> > >>>> > pcie_gen = 1<br>
>> > >>>> >
pcie_num_lanes = 16<br>
>> > >>>> ><br>
>> > >>>> > Theoretical
bandwidth from those values: 4.0 GB/s<br>
>> > >>>> > My DMA test shows
this write bandwidth: 3.5 GB/s<br>
>> > >>>> > It matches the
expectation.<br>
>> > >>>> ><br>
>> > >>>> > Let's see the
devices (there is only 1 GPU Navi21 in the system):<br>
>> > >>>> > $ lspci |egrep
'(PCI|VGA).*Navi'<br>
>> > >>>> > 0a:00.0 PCI
bridge: Advanced Micro Devices, Inc. [AMD/ATI] Navi<br>
>> > >>>> 10 XL<br>
>> > >>>> > Upstream Port of
PCI Express Switch (rev c3)<br>
>> > >>>> > 0b:00.0 PCI
bridge: Advanced Micro Devices, Inc. [AMD/ATI] Navi<br>
>> > >>>> 10 XL<br>
>> > >>>> > Downstream Port of
PCI Express Switch<br>
>> > >>>> > 0c:00.0 VGA
compatible controller: Advanced Micro Devices, Inc.<br>
>> > >>>> > [AMD/ATI] Navi 21
[Radeon RX 6800/6800 XT / 6900 XT] (rev c3)<br>
>> > >>>> ><br>
>> > >>>> > Let's read sysfs:<br>
>> > >>>> ><br>
>> > >>>> > $ cat
/sys/bus/pci/devices/0000:0a:00.0/current_link_width<br>
>> > >>>> > 16<br>
>> > >>>> > $ cat
/sys/bus/pci/devices/0000:0b:00.0/current_link_width<br>
>> > >>>> > 16<br>
>> > >>>> > $ cat
/sys/bus/pci/devices/0000:0c:00.0/current_link_width<br>
>> > >>>> > 16<br>
>> > >>>> > $ cat
/sys/bus/pci/devices/0000:0a:00.0/current_link_speed<br>
>> > >>>> > 2.5 GT/s PCIe<br>
>> > >>>> > $ cat
/sys/bus/pci/devices/0000:0b:00.0/current_link_speed<br>
>> > >>>> > 16.0 GT/s PCIe<br>
>> > >>>> > $ cat
/sys/bus/pci/devices/0000:0c:00.0/current_link_speed<br>
>> > >>>> > 16.0 GT/s PCIe<br>
>> > >>>> ><br>
>> > >>>> > Problem 1: None of
the speed numbers match 4 GB/s.<br>
>> > >>>><br>
>> > >>>> US bridge = 2.5GT/s
means operating at PCIe Gen 1 speed. Total<br>
>> > >>>> theoretical bandwidth is
then derived based on encoding and total<br>
>> > >>>> number<br>
>> > >>>> of lanes.<br>
>> > >>>><br>
>> > >>>> > Problem 2:
Userspace doesn't know the bus index of the bridges,<br>
>> > >>>> and it's<br>
>> > >>>> > not clear which
bridge should be used.<br>
>> > >>>><br>
>> > >>>> In general, modern ones
have this arch= US->DS->EP. US is the one<br>
>> > >>>> connected to physical
link.<br>
>> > >>>><br>
>> > >>>> > Problem 3: The
PCIe gen number is missing.<br>
>> > >>>><br>
>> > >>>> Current link speed is
based on whether it's Gen1/2/3/4/5.<br>
>> > >>>><br>
>> > >>>> BTW, your patch makes
use of capabilities flags which gives the maximum<br>
>> > >>>> supported speed/width by
the device. It may not necessarily reflect the<br>
>> > >>>> current speed/width
negotiated. I guess in NV, this info is already<br>
>> > >>>> obtained from PMFW and
made available through metrics table.<br>
>> > >>>><br>
>> > >>>><br>
>> > >>>> It computes the minimum of
the device PCIe gen and the motherboard/slot<br>
>> > >>>> PCIe gen to get the final
value. These 2 lines do that. The low 16 bits<br>
>> > >>>> of the mask contain the
device PCIe gen mask. The high 16 bits of the<br>
>> > >>>> mask contain the slot PCIe
gen mask.<br>
>> > >>>> + pcie_gen_mask =
adev->pm.pcie_gen_mask & (adev->pm.pcie_gen_mask
>> 16);<br>
>> > >>>> + dev_info->pcie_gen =
fls(pcie_gen_mask);<br>
>> > >>>><br>
>> > >>> With DPM in place on some ASICs,
how much does this static info help for<br>
>> > >>> upper level apps?<br>
>> > >>><br>
>> > >>><br>
>> > >>> It helps UMDs make better
decisions if they know the maximum achievable bandwidth.
UMDs also compute the maximum memory bandwidth and compute
performance (FLOPS). Right now it's printed by Mesa to give
users detailed information about their GPU. For example:<br>
>> > >>><br>
>> > >>> $ AMD_DEBUG=info glxgears<br>
>> > >>> Device info:<br>
>> > >>> name = NAVI21<br>
>> > >>> marketing_name = AMD Radeon
RX 6800<br>
>> > >>> num_se = 3<br>
>> > >>> num_rb = 12<br>
>> > >>> num_cu = 60<br>
>> > >>> max_gpu_freq = 2475 MHz<br>
>> > >>> max_gflops = 19008 GFLOPS<br>
>> > >>> l0_cache_size = 16 KB<br>
>> > >>> l1_cache_size = 128 KB<br>
>> > >>> l2_cache_size = 4096 KB<br>
>> > >>> l3_cache_size = 128 MB<br>
>> > >>> memory_channels = 16 (TCC
blocks)<br>
>> > >>> memory_size = 16 GB (16384
MB)<br>
>> > >>> memory_freq = 16 GHz<br>
>> > >>> memory_bus_width = 256 bits<br>
>> > >>> memory_bandwidth = 512 GB/s<br>
>> > >>> pcie_gen = 1<br>
>> > >>> pcie_num_lanes = 16<br>
>> > >>> pcie_bandwidth = 4.0 GB/s<br>
>> > >>><br>
>> > >>> Marek<br>
>> ><br>
</blockquote>
</div>
</div>
</blockquote>
<br>
</body>
</html>