AMD-GFX Archive on lore.kernel.org
 help / color / Atom feed
* drm/amdkfd: Change pasid's type to unsigned int
@ 2020-05-22 19:25 Fenghua Yu
  2020-05-22 19:40 ` Felix Kuehling
  0 siblings, 1 reply; 4+ messages in thread
From: Fenghua Yu @ 2020-05-22 19:25 UTC (permalink / raw)
  To: Yong Zhao, Felix Kuehling; +Cc: amd-gfx

Hi, Yong,

In commit: 6027b1bf6071fc61a5aa11b9922a2e0e91bff1ea
    drm/amdkfd: Use hex print format for pasid

pasid's type was change to "uint16_t" from "unsigned int" in
struct kfd_process.

But, pasid is a 20-bit value according to PCIe spec and other places
in amdkfd (plus other iommu code) define pasid as "unsigned int".
If defined as uint16_t, pasid will overflow if its value is bigger than 16-bit.

Did I miss anything? Should we change pasid's type back to "unsigned int"?

[a little background: pasid is defined as various types including "int",
"unsigned int", "u32" in iommu. I'm changing pasid's types to "unsigned int"
so that the types are consistent in iommu]

Thanks.

-Fenghua
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: drm/amdkfd: Change pasid's type to unsigned int
  2020-05-22 19:25 drm/amdkfd: Change pasid's type to unsigned int Fenghua Yu
@ 2020-05-22 19:40 ` Felix Kuehling
  2020-05-22 21:21   ` Fenghua Yu
  0 siblings, 1 reply; 4+ messages in thread
From: Felix Kuehling @ 2020-05-22 19:40 UTC (permalink / raw)
  To: Fenghua Yu, Yong Zhao; +Cc: amd-gfx

Hi Fenghua,

The PASID width in KFD is currently limited to 16 bits. I believe this
reflects what our hardware can handle. KFD will never allocate a PASID
bigger than 16 bits. That said, I'm OK with changing this field in the
kfd_process structure to unsigned int. Generally, I find uint16_t in
structures not very useful except in tightly packed structures such as
packet formats or ioctl arguments.

Regards,
  Felix

Am 2020-05-22 um 3:25 p.m. schrieb Fenghua Yu:
> Hi, Yong,
>
> In commit: 6027b1bf6071fc61a5aa11b9922a2e0e91bff1ea
>     drm/amdkfd: Use hex print format for pasid
>
> pasid's type was change to "uint16_t" from "unsigned int" in
> struct kfd_process.
>
> But, pasid is a 20-bit value according to PCIe spec and other places
> in amdkfd (plus other iommu code) define pasid as "unsigned int".
> If defined as uint16_t, pasid will overflow if its value is bigger than 16-bit.
>
> Did I miss anything? Should we change pasid's type back to "unsigned int"?
>
> [a little background: pasid is defined as various types including "int",
> "unsigned int", "u32" in iommu. I'm changing pasid's types to "unsigned int"
> so that the types are consistent in iommu]
>
> Thanks.
>
> -Fenghua
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: drm/amdkfd: Change pasid's type to unsigned int
  2020-05-22 19:40 ` Felix Kuehling
@ 2020-05-22 21:21   ` Fenghua Yu
  2020-05-23  3:14     ` Zhao, Yong
  0 siblings, 1 reply; 4+ messages in thread
From: Fenghua Yu @ 2020-05-22 21:21 UTC (permalink / raw)
  To: Felix Kuehling; +Cc: Yong Zhao, amd-gfx

Hi, Felix,

On Fri, May 22, 2020 at 03:40:06PM -0400, Felix Kuehling wrote:
> Hi Fenghua,
> 
> The PASID width in KFD is currently limited to 16 bits. I believe this
> reflects what our hardware can handle. KFD will never allocate a PASID
> bigger than 16 bits. That said, I'm OK with changing this field in the
> kfd_process structure to unsigned int. Generally, I find uint16_t in
> structures not very useful except in tightly packed structures such as
> packet formats or ioctl arguments.

Thank you very much for your insight!

I'm writing the patch set to define pasid as "unsigned int" consistently
in iommu. I'll put the amdkfd changes (only a few changes including this
pasid change in struct kfd_processin) one patch and send it to you for
review.

-Fenghua
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: drm/amdkfd: Change pasid's type to unsigned int
  2020-05-22 21:21   ` Fenghua Yu
@ 2020-05-23  3:14     ` Zhao, Yong
  0 siblings, 0 replies; 4+ messages in thread
From: Zhao, Yong @ 2020-05-23  3:14 UTC (permalink / raw)
  To: Fenghua Yu, Kuehling, Felix; +Cc: amd-gfx

[-- Attachment #1.1: Type: text/plain, Size: 1222 bytes --]

[AMD Official Use Only - Internal Distribution Only]

Hi Fenghua,

I am okay with the idea.

Regards,
Yong
________________________________
From: Fenghua Yu <fenghua.yu@intel.com>
Sent: Friday, May 22, 2020 5:21 PM
To: Kuehling, Felix <Felix.Kuehling@amd.com>
Cc: Zhao, Yong <Yong.Zhao@amd.com>; amd-gfx@lists.freedesktop.org <amd-gfx@lists.freedesktop.org>
Subject: Re: drm/amdkfd: Change pasid's type to unsigned int

Hi, Felix,

On Fri, May 22, 2020 at 03:40:06PM -0400, Felix Kuehling wrote:
> Hi Fenghua,
>
> The PASID width in KFD is currently limited to 16 bits. I believe this
> reflects what our hardware can handle. KFD will never allocate a PASID
> bigger than 16 bits. That said, I'm OK with changing this field in the
> kfd_process structure to unsigned int. Generally, I find uint16_t in
> structures not very useful except in tightly packed structures such as
> packet formats or ioctl arguments.

Thank you very much for your insight!

I'm writing the patch set to define pasid as "unsigned int" consistently
in iommu. I'll put the amdkfd changes (only a few changes including this
pasid change in struct kfd_processin) one patch and send it to you for
review.

-Fenghua

[-- Attachment #1.2: Type: text/html, Size: 2748 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-22 19:25 drm/amdkfd: Change pasid's type to unsigned int Fenghua Yu
2020-05-22 19:40 ` Felix Kuehling
2020-05-22 21:21   ` Fenghua Yu
2020-05-23  3:14     ` Zhao, Yong

AMD-GFX Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/amd-gfx/0 amd-gfx/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 amd-gfx amd-gfx/ https://lore.kernel.org/amd-gfx \
		amd-gfx@lists.freedesktop.org
	public-inbox-index amd-gfx

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.freedesktop.lists.amd-gfx


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git