Skip to contentSkip to conversation

amdkfd: always include uapi header in priv.h

PATCH RESEND In review Zhu Lingshan 3 participants 8 messages Oct 31, 2024 – Dec 13, 2024

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 amdkfd: always include uapi header in priv.h

The header usr/linux/kfd_ioctl.h is a duplicate of uapi/linux/kfd_ioctl.h. And it is actually not a file in the source code tree.
Ideally, the usr version should be updated whenever the source code is recompiled.

However, I have noticed a discrepancy between the two headers even after rebuilding the kernel.

This commit modifies kfd_priv.h to always include the header from uapi to ensure the latest changes are reflected. We should always include the source code header other than the duplication.

---
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +1 -1
index 26e48fdc8728..78de7ac09e8a 100644
@@ -32,7 +32,7 @@
 #include <linux/atomic.h>
 #include <linux/workqueue.h>
 #include <linux/spinlock.h>
-#include <linux/kfd_ioctl.h>
+#include <uapi/linux/kfd_ioctl.h>
 #include <linux/idr.h>
 #include <linux/kfifo.h>
 #include <linux/seq_file.h>
Signature · 1 line
2.43.5
maintainer
#1 lore raw
Quoted 1 line · Zhu Lingshan

The header usr/linux/kfd_ioctl.h is a duplicate of uapi/linux/kfd_ioctl.h.

I don't see usr/linux/kfd_ioctl.h. Which branch are you looking at?

Quoted 1 line

And it is actually not a file in the source code tree.

If it's a file that only there on your local working tree, maybe just clean up your working tree.

Quoted 1 line

Ideally, the usr version should be updated whenever the source code is recompiled.

If the usr version is not in the git repository, it doesn't need to be updated. I don't know where this is coming from on your local tree.

Regards,
Felix

Quoted 26 lines

However, I have noticed a discrepancy between the two headers even after rebuilding the kernel.

This commit modifies kfd_priv.h to always include the header from uapi to ensure the latest changes are reflected. We should always include the source code header other than the duplication.

---
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +1 -1
index 26e48fdc8728..78de7ac09e8a 100644
@@ -32,7 +32,7 @@
 #include <linux/atomic.h>
 #include <linux/workqueue.h>
 #include <linux/spinlock.h>
-#include <linux/kfd_ioctl.h>
+#include <uapi/linux/kfd_ioctl.h>
 #include <linux/idr.h>
 #include <linux/kfifo.h>
 #include <linux/seq_file.h>
#2 lore raw
Quoted 3 lines · Felix Kuehling
Quoted 1 line · Zhu Lingshan

The header usr/linux/kfd_ioctl.h is a duplicate of uapi/linux/kfd_ioctl.h.

I don't see usr/linux/kfd_ioctl.h. Which branch are you looking at?

The mainline master branch:
https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/amd/amdkfd/kfd_priv.h#L35
#include <linux/kfd_ioctl.h>

Quoted 3 lines
Quoted 2 lines

And it is actually not a file in the source code tree.

If it's a file that only there on your local working tree, maybe just clean up your working tree.

Yes, this is a file on the local working tree, it is generated when build, it is  not in source code tree. The is even no folder usr/include/linux before building.

For a quick verify:
1) it is not a source code file from mainline:
$git blame ./usr/include/linux/kfd_ioctl.h
fatal: no such path 'usr/include/linux/kfd_ioctl.h' in HEAD

2) it is generated when build:
remove usr/include/linux/kfd_ioctl.h, then build.
If we remove a required header, kfd would not
build and there will be error messages.

but here we will see these lines:
HDRINST usr/include/linux/kfd_ioctl.h
HDRTEST usr/include/linux/kfd_ioctl.h,
no build errors, and usr/include/linux/kfd_ioctl.h is generated by duplicating the uapi one.

2) linux/kfd_ioctl.h is usr/include/linux/kfd_ioctl.h add random characters in usr/include/linux/kfd_ioctl.h, then build we will see errors like this:

In file included from <command-line>:
./usr/include/linux/kfd_ioctl.h:65:9: error: expected ‘;’ before ‘struct’ 65 | abcd1234
      |         ^
      |         ;
   66 |
   67 | struct kfd_ioctl_create_queue_args {
      | ~~~~~~

Quoted 3 lines
Quoted 2 lines

Ideally, the usr version should be updated whenever the source code is recompiled.

If the usr version is not in the git repository, it doesn't need to be updated. I don't know where this is coming from on your local tree.

the usr one would be installed to the system when run make install or install_headers, it is for user space, we should include the uapi one instead of usr one in our source code files

Thanks
Lingshan

Quoted 29 lines

Regards,
Felix

Quoted 25 lines

However, I have noticed a discrepancy between the two headers even after rebuilding the kernel.

This commit modifies kfd_priv.h to always include the header from uapi to ensure the latest changes are reflected. We should always include the source code header other than the duplication.

---
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +1 -1
index 26e48fdc8728..78de7ac09e8a 100644
@@ -32,7 +32,7 @@
 #include <linux/atomic.h>
 #include <linux/workqueue.h>
 #include <linux/spinlock.h>
-#include <linux/kfd_ioctl.h>
+#include <uapi/linux/kfd_ioctl.h>
 #include <linux/idr.h>
 #include <linux/kfifo.h>
 #include <linux/seq_file.h>
maintainer
#3 lore raw
Quoted 43 lines · Zhu Lingshan
Quoted 3 lines · Felix Kuehling
Quoted 1 line · Zhu Lingshan

The header usr/linux/kfd_ioctl.h is a duplicate of uapi/linux/kfd_ioctl.h.

I don't see usr/linux/kfd_ioctl.h. Which branch are you looking at?

The mainline master branch:
https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/amd/amdkfd/kfd_priv.h#L35
#include <linux/kfd_ioctl.h>

Quoted 3 lines
Quoted 2 lines

And it is actually not a file in the source code tree.

If it's a file that only there on your local working tree, maybe just clean up your working tree.

Yes, this is a file on the local working tree, it is generated when build, it is  not in source code tree. The is even no folder usr/include/linux before building.

For a quick verify:
1) it is not a source code file from mainline:
$git blame ./usr/include/linux/kfd_ioctl.h
fatal: no such path 'usr/include/linux/kfd_ioctl.h' in HEAD

2) it is generated when build:
remove usr/include/linux/kfd_ioctl.h, then build.
If we remove a required header, kfd would not
build and there will be error messages.

but here we will see these lines:
HDRINST usr/include/linux/kfd_ioctl.h
HDRTEST usr/include/linux/kfd_ioctl.h,
no build errors, and usr/include/linux/kfd_ioctl.h is generated by duplicating the uapi one.

2) linux/kfd_ioctl.h is usr/include/linux/kfd_ioctl.h add random characters in usr/include/linux/kfd_ioctl.h, then build we will see errors like this:

In file included from <command-line>:
./usr/include/linux/kfd_ioctl.h:65:9: error: expected ‘;’ before ‘struct’ 65 | abcd1234
      |         ^
      |         ;
   66 |
   67 | struct kfd_ioctl_create_queue_args {
      | ~~~~~~

Quoted 1 line
Quoted 4 lines
Quoted 2 lines
Quoted 1 line

Ideally, the usr version should be updated whenever the source code is recompiled.

If the usr version is not in the git repository, it doesn't need to be updated. I don't know where this is coming from on your local tree.

the usr one would be installed to the system when run make install or install_headers, it is for user space, we should include the uapi one instead of usr one in our source code files

I did not see the folder in my tree because I build with O=... so usr/include/linux/kfd_ioctl.h shows up in my build output tree.

The extra copy of the user mode headers seems to be an artifact of the Linux kernel build system. The fact that the build picks up user mode headers from <OUT>/usr/include/... seems intentional. If your tree has an outdated version of kfd_ioctl.h there, it's probably something broken with your build tree. Maybe broken file timestamps. It should be easy to fix with a "make mrproper" to force it to update all the build artifacts.

I still don't think we need to change the code to fix a problem specific to your build system.

Regards,
Felix

Quoted 33 lines

Thanks
Lingshan

Quoted 29 lines

Regards,
Felix

Quoted 25 lines

However, I have noticed a discrepancy between the two headers even after rebuilding the kernel.

This commit modifies kfd_priv.h to always include the header from uapi to ensure the latest changes are reflected. We should always include the source code header other than the duplication.

---
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +1 -1
index 26e48fdc8728..78de7ac09e8a 100644
@@ -32,7 +32,7 @@
 #include <linux/atomic.h>
 #include <linux/workqueue.h>
 #include <linux/spinlock.h>
-#include <linux/kfd_ioctl.h>
+#include <uapi/linux/kfd_ioctl.h>
 #include <linux/idr.h>
 #include <linux/kfifo.h>
 #include <linux/seq_file.h>
#4 lore raw
Quoted 42 lines · Felix Kuehling
Quoted 41 lines · Zhu Lingshan
Quoted 3 lines · Felix Kuehling
Quoted 1 line · Zhu Lingshan

The header usr/linux/kfd_ioctl.h is a duplicate of uapi/linux/kfd_ioctl.h.

I don't see usr/linux/kfd_ioctl.h. Which branch are you looking at?

The mainline master branch:
https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/amd/amdkfd/kfd_priv.h#L35
#include <linux/kfd_ioctl.h>

Quoted 2 lines
Quoted 1 line

And it is actually not a file in the source code tree.

If it's a file that only there on your local working tree, maybe just clean up your working tree.

Yes, this is a file on the local working tree, it is generated when build, it is  not in source code tree. The is even no folder usr/include/linux before building.

For a quick verify:
1) it is not a source code file from mainline:
$git blame ./usr/include/linux/kfd_ioctl.h
fatal: no such path 'usr/include/linux/kfd_ioctl.h' in HEAD

2) it is generated when build:
remove usr/include/linux/kfd_ioctl.h, then build.
If we remove a required header, kfd would not
build and there will be error messages.

but here we will see these lines:
HDRINST usr/include/linux/kfd_ioctl.h
HDRTEST usr/include/linux/kfd_ioctl.h,
no build errors, and usr/include/linux/kfd_ioctl.h is generated by duplicating the uapi one.

2) linux/kfd_ioctl.h is usr/include/linux/kfd_ioctl.h add random characters in usr/include/linux/kfd_ioctl.h, then build we will see errors like this:

In file included from <command-line>:
./usr/include/linux/kfd_ioctl.h:65:9: error: expected ‘;’ before ‘struct’ 65 | abcd1234
      |         ^
      |         ;
   66 |
   67 | struct kfd_ioctl_create_queue_args {
      | ~~~~~~

Quoted 5 lines
Quoted 4 lines
Quoted 2 lines
Quoted 1 line

Ideally, the usr version should be updated whenever the source code is recompiled.

If the usr version is not in the git repository, it doesn't need to be updated. I don't know where this is coming from on your local tree.

the usr one would be installed to the system when run make install or install_headers, it is for user space, we should include the uapi one instead of usr one in our source code files

I did not see the folder in my tree because I build with O=... so usr/include/linux/kfd_ioctl.h shows up in my build output tree.

exactly! usr/include/linux/kfd_ioctl.h is not shown until we build the kernel, it is a duplication of the uapi header generated by kernel "make", that is why we did not see it until "make". If you run git blame usr/include/linux/kfd_ioctl.h, git will tell us: fatal: no such path 'usr/include/linux/kfd_ioctl.h' in HEAD

In a fresh cloned kernel tree, without "make", in usr/include, try [lszhu@localhost include]$ find -name kfd_ioctl.h shows nothing, usr/include/linux/kfd_ioct.h is not there until build the kernel.

Means 'usr/include/linux/kfd_ioctl.h' is not a source code file, thus we should include the original uapi one in our code.

Quoted 2 lines

The extra copy of the user mode headers seems to be an artifact of the Linux kernel build system. The fact that the build picks up user mode headers from <OUT>/usr/include/... seems intentional. If your tree has an outdated version of kfd_ioctl.h there, it's probably something broken with your build tree. Maybe broken file timestamps. It should be easy to fix with a "make mrproper" to force it to update all the build artifacts.

the usr one is an extra copy, kernel build system copies headers from uapi folder to usr/include/linux, so the uapi headers are the original ones.

Thanks
Lingshan

Quoted 36 lines

I still don't think we need to change the code to fix a problem specific to your build system.

Regards,
Felix

Quoted 30 lines

Thanks
Lingshan

Quoted 28 lines

Regards,
Felix

Quoted 25 lines

However, I have noticed a discrepancy between the two headers even after rebuilding the kernel.

This commit modifies kfd_priv.h to always include the header from uapi to ensure the latest changes are reflected. We should always include the source code header other than the duplication.

---
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +1 -1
index 26e48fdc8728..78de7ac09e8a 100644
@@ -32,7 +32,7 @@
 #include <linux/atomic.h>
 #include <linux/workqueue.h>
 #include <linux/spinlock.h>
-#include <linux/kfd_ioctl.h>
+#include <uapi/linux/kfd_ioctl.h>
 #include <linux/idr.h>
 #include <linux/kfifo.h>
 #include <linux/seq_file.h>
#5 lore raw
In reply to Felix Kuehling
Quoted 47 lines · Felix Kuehling
Quoted 45 lines · Zhu Lingshan
Quoted 3 lines · Felix Kuehling
Quoted 1 line · Zhu Lingshan

The header usr/linux/kfd_ioctl.h is a duplicate of uapi/linux/kfd_ioctl.h.

I don't see usr/linux/kfd_ioctl.h. Which branch are you looking at?

The mainline master branch:
https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/amd/amdkfd/kfd_priv.h#L35
#include <linux/kfd_ioctl.h>

Quoted 3 lines
Quoted 2 lines

And it is actually not a file in the source code tree.

If it's a file that only there on your local working tree, maybe just clean up your working tree.

Yes, this is a file on the local working tree, it is generated when build, it is  not in source code tree. The is even no folder usr/include/linux before building.

For a quick verify:
1) it is not a source code file from mainline:
$git blame ./usr/include/linux/kfd_ioctl.h
fatal: no such path 'usr/include/linux/kfd_ioctl.h' in HEAD

2) it is generated when build:
remove usr/include/linux/kfd_ioctl.h, then build.
If we remove a required header, kfd would not
build and there will be error messages.

but here we will see these lines:
HDRINST usr/include/linux/kfd_ioctl.h
HDRTEST usr/include/linux/kfd_ioctl.h,
no build errors, and usr/include/linux/kfd_ioctl.h is generated by duplicating the uapi one.

2) linux/kfd_ioctl.h is usr/include/linux/kfd_ioctl.h add random characters in usr/include/linux/kfd_ioctl.h, then build we will see errors like this:

In file included from <command-line>:
./usr/include/linux/kfd_ioctl.h:65:9: error: expected ‘;’ before ‘struct’ 65 | abcd1234
      |         ^
      |         ;
   66 |
   67 | struct kfd_ioctl_create_queue_args {
      | ~~~~~~

Quoted 3 lines
Quoted 2 lines

Ideally, the usr version should be updated whenever the source code is recompiled.

If the usr version is not in the git repository, it doesn't need to be updated. I don't know where this is coming from on your local tree.

Quoted 9 lines
Quoted 2 lines

the usr one would be installed to the system when run make install or install_headers, it is for user space, we should include the uapi one instead of usr one in our source code files

I did not see the folder in my tree because I build with O=... so usr/include/linux/kfd_ioctl.h shows up in my build output tree.

The extra copy of the user mode headers seems to be an artifact of the Linux kernel build system. The fact that the build picks up user mode headers from <OUT>/usr/include/... seems intentional. If your tree has an outdated version of kfd_ioctl.h there, it's probably something broken with your build tree. Maybe broken file timestamps. It should be easy to fix with a "make mrproper" to force it to update all the build artifacts.

I still don't think we need to change the code to fix a problem specific to your build system.

Looking at the number of occurrences with "#include <uapi/", it appears like explicitly mentioning as uapi/linux for header location is a better practice.

Thanks,
Lijo

Quoted 36 lines

Regards,
Felix

Quoted 33 lines

Thanks
Lingshan

Quoted 29 lines

Regards,
Felix

Quoted 25 lines

However, I have noticed a discrepancy between the two headers even after rebuilding the kernel.

This commit modifies kfd_priv.h to always include the header from uapi to ensure the latest changes are reflected. We should always include the source code header other than the duplication.

---
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +1 -1
index 26e48fdc8728..78de7ac09e8a 100644
@@ -32,7 +32,7 @@
 #include <linux/atomic.h>
 #include <linux/workqueue.h>
 #include <linux/spinlock.h>
-#include <linux/kfd_ioctl.h>
+#include <uapi/linux/kfd_ioctl.h>
 #include <linux/idr.h>
 #include <linux/kfifo.h>
 #include <linux/seq_file.h>
#6 lore raw
Quoted 50 lines · Lijo
Quoted 48 lines · Felix Kuehling
Quoted 41 lines · Zhu Lingshan
Quoted 3 lines · Felix Kuehling
Quoted 1 line · Zhu Lingshan

The header usr/linux/kfd_ioctl.h is a duplicate of uapi/linux/kfd_ioctl.h.

I don't see usr/linux/kfd_ioctl.h. Which branch are you looking at?

The mainline master branch:
https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/amd/amdkfd/kfd_priv.h#L35
#include <linux/kfd_ioctl.h>

Quoted 2 lines
Quoted 1 line

And it is actually not a file in the source code tree.

If it's a file that only there on your local working tree, maybe just clean up your working tree.

Yes, this is a file on the local working tree, it is generated when build, it is  not in source code tree. The is even no folder usr/include/linux before building.

For a quick verify:
1) it is not a source code file from mainline:
$git blame ./usr/include/linux/kfd_ioctl.h
fatal: no such path 'usr/include/linux/kfd_ioctl.h' in HEAD

2) it is generated when build:
remove usr/include/linux/kfd_ioctl.h, then build.
If we remove a required header, kfd would not
build and there will be error messages.

but here we will see these lines:
HDRINST usr/include/linux/kfd_ioctl.h
HDRTEST usr/include/linux/kfd_ioctl.h,
no build errors, and usr/include/linux/kfd_ioctl.h is generated by duplicating the uapi one.

2) linux/kfd_ioctl.h is usr/include/linux/kfd_ioctl.h add random characters in usr/include/linux/kfd_ioctl.h, then build we will see errors like this:

In file included from <command-line>:
./usr/include/linux/kfd_ioctl.h:65:9: error: expected ‘;’ before ‘struct’ 65 | abcd1234
      |         ^
      |         ;
   66 |
   67 | struct kfd_ioctl_create_queue_args {
      | ~~~~~~

Quoted 4 lines
Quoted 2 lines
Quoted 1 line

Ideally, the usr version should be updated whenever the source code is recompiled.

If the usr version is not in the git repository, it doesn't need to be updated. I don't know where this is coming from on your local tree.

the usr one would be installed to the system when run make install or install_headers, it is for user space, we should include the uapi one instead of usr one in our source code files

I did not see the folder in my tree because I build with O=... so usr/include/linux/kfd_ioctl.h shows up in my build output tree.

Quoted 7 lines
Quoted 4 lines

The extra copy of the user mode headers seems to be an artifact of the Linux kernel build system. The fact that the build picks up user mode headers from <OUT>/usr/include/... seems intentional. If your tree has an outdated version of kfd_ioctl.h there, it's probably something broken with your build tree. Maybe broken file timestamps. It should be easy to fix with a "make mrproper" to force it to update all the build artifacts.

I still don't think we need to change the code to fix a problem specific to your build system.

Looking at the number of occurrences with "#include <uapi/", it appears like explicitly mentioning as uapi/linux for header location is a better practice.

Gentle ping, Felix

Thanks
Lingshan

Quoted 37 lines

Thanks,
Lijo

Quoted 33 lines

Regards,
Felix

Quoted 30 lines

Thanks
Lingshan

Quoted 28 lines

Regards,
Felix

Quoted 25 lines

However, I have noticed a discrepancy between the two headers even after rebuilding the kernel.

This commit modifies kfd_priv.h to always include the header from uapi to ensure the latest changes are reflected. We should always include the source code header other than the duplication.

---
 drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +1 -1
index 26e48fdc8728..78de7ac09e8a 100644
@@ -32,7 +32,7 @@
 #include <linux/atomic.h>
 #include <linux/workqueue.h>
 #include <linux/spinlock.h>
-#include <linux/kfd_ioctl.h>
+#include <uapi/linux/kfd_ioctl.h>
 #include <linux/idr.h>
 #include <linux/kfifo.h>
 #include <linux/seq_file.h>
maintainer Reviewed-by
#7 lore raw
Quoted 50 lines · Zhu Lingshan
Quoted 49 lines · Lijo
Quoted 48 lines · Felix Kuehling
Quoted 41 lines · Zhu Lingshan
Quoted 3 lines · Felix Kuehling
Quoted 1 line · Zhu Lingshan

The header usr/linux/kfd_ioctl.h is a duplicate of uapi/linux/kfd_ioctl.h.

I don't see usr/linux/kfd_ioctl.h. Which branch are you looking at?

The mainline master branch:
https://github.com/torvalds/linux/blob/master/drivers/gpu/drm/amd/amdkfd/kfd_priv.h#L35
#include <linux/kfd_ioctl.h>

Quoted 2 lines
Quoted 1 line

And it is actually not a file in the source code tree.

If it's a file that only there on your local working tree, maybe just clean up your working tree.

Yes, this is a file on the local working tree, it is generated when build, it is  not in source code tree. The is even no folder usr/include/linux before building.

For a quick verify:
1) it is not a source code file from mainline:
$git blame ./usr/include/linux/kfd_ioctl.h
fatal: no such path 'usr/include/linux/kfd_ioctl.h' in HEAD

2) it is generated when build:
remove usr/include/linux/kfd_ioctl.h, then build.
If we remove a required header, kfd would not
build and there will be error messages.

but here we will see these lines:
HDRINST usr/include/linux/kfd_ioctl.h
HDRTEST usr/include/linux/kfd_ioctl.h,
no build errors, and usr/include/linux/kfd_ioctl.h is generated by duplicating the uapi one.

2) linux/kfd_ioctl.h is usr/include/linux/kfd_ioctl.h add random characters in usr/include/linux/kfd_ioctl.h, then build we will see errors like this:

In file included from <command-line>:
./usr/include/linux/kfd_ioctl.h:65:9: error: expected ‘;’ before ‘struct’
   65 | abcd1234
      |         ^
      |         ;
   66 |
   67 | struct kfd_ioctl_create_queue_args {
      | ~~~~~~

Quoted 4 lines
Quoted 2 lines
Quoted 1 line

Ideally, the usr version should be updated whenever the source code is recompiled.

If the usr version is not in the git repository, it doesn't need to be updated. I don't know where this is coming from on your local tree.

the usr one would be installed to the system when run make install or install_headers, it is for user space, we should include the uapi one instead of usr one in our source code files

I did not see the folder in my tree because I build with O=... so usr/include/linux/kfd_ioctl.h shows up in my build output tree.

Quoted 8 lines
Quoted 7 lines
Quoted 4 lines

The extra copy of the user mode headers seems to be an artifact of the Linux kernel build system. The fact that the build picks up user mode headers from <OUT>/usr/include/... seems intentional. If your tree has an outdated version of kfd_ioctl.h there, it's probably something broken with your build tree. Maybe broken file timestamps. It should be easy to fix with a "make mrproper" to force it to update all the build artifacts.

I still don't think we need to change the code to fix a problem specific to your build system.

Looking at the number of occurrences with "#include <uapi/", it appears like explicitly mentioning as uapi/linux for header location is a better practice.

Gentle ping, Felix

Quoted 39 lines

Thanks
Lingshan

Quoted 36 lines

Thanks,
Lijo

Quoted 33 lines

Regards,
Felix

Quoted 30 lines

Thanks
Lingshan

Quoted 28 lines

Regards,
Felix

Quoted 25 lines

However, I have noticed a discrepancy between the two headers even after rebuilding the kernel.

This commit modifies kfd_priv.h to always include the header from uapi to ensure the latest changes are reflected. We should always include the source code header other than the duplication.

---
  drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +1 -1
index 26e48fdc8728..78de7ac09e8a 100644
@@ -32,7 +32,7 @@
  #include <linux/atomic.h>
  #include <linux/workqueue.h>
  #include <linux/spinlock.h>
-#include <linux/kfd_ioctl.h>
+#include <uapi/linux/kfd_ioctl.h>
  #include <linux/idr.h>
  #include <linux/kfifo.h>
  #include <linux/seq_file.h>