Re: [PATCH] kernel/resource: optimize find_next_iomem_res

2024-06-04 Thread Chia-I Wu
On Tue, Jun 4, 2024 at 8:41 AM Greg Kroah-Hartman wrote: > > On Thu, May 30, 2024 at 10:36:57PM -0700, Chia-I Wu wrote: > > We can skip children resources when the parent resource does not cover > > the range. > > > > This should help vmf_insert_* users on x86, such

Re: [PATCH] kernel/resource: optimize find_next_iomem_res

2024-06-03 Thread Chia-I Wu
On Mon, Jun 3, 2024 at 12:24 AM Ilpo Järvinen wrote: > > On Sun, 2 Jun 2024, Andy Shevchenko wrote: > > > On Fri, May 31, 2024 at 02:31:45PM -0700, Chia-I Wu wrote: > > > On Fri, May 31, 2024 at 1:57 AM Andy Shevchenko < > > > andriy.shevche...@linux.intel.com&

Re: [PATCH] kernel/resource: optimize find_next_iomem_res

2024-05-31 Thread Chia-I Wu
On Fri, May 31, 2024 at 1:57 AM Andy Shevchenko < andriy.shevche...@linux.intel.com> wrote: > On Thu, May 30, 2024 at 10:36:57PM -0700, Chia-I Wu wrote: > > We can skip children resources when the parent resource does not cover > > the range. > > > > This shou

[PATCH] kernel/resource: optimize find_next_iomem_res

2024-05-30 Thread Chia-I Wu
%--__do_fault 26.57%--amdgpu_gem_fault 25.83%--ttm_bo_vm_fault_reserved 24.40%--vmf_insert_pfn_prot 14.30%--track_pfn_insert 12.20%--lookup_memtype 9.34%--pat_pagerange_is_ram 8.22%--walk_system_ram_range 5.09%--find_next_iomem_res after. Signed-off-by: Chia-I Wu --- kernel/resource.c | 8

Re: [PATCH AUTOSEL 5.10 13/22] drm/amdgpu: install stub fence into potential unused fence pointers

2023-08-31 Thread Chia-I Wu
On Thu, Aug 31, 2023 at 7:01 AM Greg KH wrote: > > On Thu, Aug 31, 2023 at 03:26:28PM +0200, Christian König wrote: > > Am 31.08.23 um 12:56 schrieb Greg KH: > > > On Thu, Aug 31, 2023 at 12:27:27PM +0200, Christian König wrote: > > > > Am 30.08.23 um 20:53 sc

Re: [PATCH AUTOSEL 5.10 13/22] drm/amdgpu: install stub fence into potential unused fence pointers

2023-08-30 Thread Chia-I Wu
On Sun, Jul 23, 2023 at 6:24 PM Sasha Levin wrote: > > From: Lang Yu > > [ Upstream commit 187916e6ed9d0c3b3abc27429f7a5f8c936bd1f0 ] > > When using cpu to update page tables, vm update fences are unused. > Install stub fence into these fence pointers instead of NULL > to avoid NULL dereference w

Re: [PATCH] drm/amdgpu: fix xclk freq on CHIP_STONEY

2023-06-02 Thread Chia-I Wu
On Fri, Jun 2, 2023 at 11:50 AM Alex Deucher wrote: > > Nevermind, missing your Signed-off-by. Please add and I'll apply. Sorry that I keep forgetting... This patch is Signed-off-by: Chia-I Wu I can send v2 if necessary. > > Alex >

[PATCH v3] amdgpu: validate offset_in_bo of drm_amdgpu_gem_va

2023-06-01 Thread Chia-I Wu
y use the VM map parameters") Signed-off-by: Chia-I Wu --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c index 22f9a65ca0fc7..76d

[PATCH] drm/amdgpu: fix xclk freq on CHIP_STONEY

2023-06-01 Thread Chia-I Wu
According to Alex, most APUs from that time seem to have the same issue (vbios says 48Mhz, actual is 100Mhz). I only have a CHIP_STONEY so I limit the fixup to CHIP_STONEY --- drivers/gpu/drm/amd/amdgpu/vi.c | 11 +-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/g

[PATCH v2] amdgpu: validate drm_amdgpu_gem_va addrs

2023-05-23 Thread Chia-I Wu
offset_in_bo+map_size overflows. Userspace (radeonsi and radv) seems fine as well. v2: keep the validations in amdgpu_vm_bo_map Fixes: 9f7eb5367d00 ("drm/amdgpu: actually use the VM map parameters") Signed-off-by: Chia-I Wu --- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 15 +++ d

Re: [PATCH 1/2] amdgpu: validate drm_amdgpu_gem_va addrs for all ops

2023-05-23 Thread Chia-I Wu
On Mon, May 22, 2023 at 12:12 PM Christian König wrote: > > Am 21.05.23 um 20:49 schrieb Chia-I Wu: > > On Thu, May 18, 2023 at 1:12 PM Alex Deucher wrote: > >> On Wed, May 17, 2023 at 5:27 PM Chia-I Wu wrote: > >>> On Tue, May 9, 2023 at 11:33 AM Chia-I Wu wro

Re: [PATCH 1/2] amdgpu: validate drm_amdgpu_gem_va addrs for all ops

2023-05-21 Thread Chia-I Wu
On Thu, May 18, 2023 at 1:12 PM Alex Deucher wrote: > > On Wed, May 17, 2023 at 5:27 PM Chia-I Wu wrote: > > > > On Tue, May 9, 2023 at 11:33 AM Chia-I Wu wrote: > > > > > > Extend the address and size validations to AMDGPU_VA_OP_UNMAP and > > > AM

Re: [PATCH 1/2] amdgpu: validate drm_amdgpu_gem_va addrs for all ops

2023-05-17 Thread Chia-I Wu
On Tue, May 9, 2023 at 11:33 AM Chia-I Wu wrote: > > Extend the address and size validations to AMDGPU_VA_OP_UNMAP and > AMDGPU_VA_OP_CLEAR by moving the validations to amdgpu_gem_va_ioctl. > > Internal users of amdgpu_vm_bo_map are no longer validated but they > should be f

[PATCH 2/2] amdgpu: validate drm_amdgpu_gem_va against overflows

2023-05-09 Thread Chia-I Wu
The existing validations are incorrect and insufficient. This is motivated by OOB access in amdgpu_vm_update_range when offset_in_bo+map_size overflows. Fixes: 9f7eb5367d00 ("drm/amdgpu: actually use the VM map parameters") --- drivers/gpu/drm/amd/amdgpu/amdgpu_gem.c | 7 +-- drivers/gpu/drm

[PATCH 1/2] amdgpu: validate drm_amdgpu_gem_va addrs for all ops

2023-05-09 Thread Chia-I Wu
Extend the address and size validations to AMDGPU_VA_OP_UNMAP and AMDGPU_VA_OP_CLEAR by moving the validations to amdgpu_gem_va_ioctl. Internal users of amdgpu_vm_bo_map are no longer validated but they should be fine. Userspace (radeonsi and radv) seems fine as well. --- drivers/gpu/drm/amd/amd

Re: [PATCH v2] drm/amdgpu: add a missing lock for AMDGPU_SCHED

2023-04-26 Thread Chia-I Wu
On Wed, Apr 26, 2023 at 4:05 AM Christian König wrote: > > Am 26.04.23 um 08:17 schrieb Chia-I Wu: > > mgr->ctx_handles should be protected by mgr->lock. > > > > v2: improve commit message > > > > Signed-off-by: Chia-I Wu > > Cc: sta...@

[PATCH v3] drm/amdgpu: add a missing lock for AMDGPU_SCHED

2023-04-26 Thread Chia-I Wu
mgr->ctx_handles should be protected by mgr->lock. v2: improve commit message v3: add a Fixes tag Signed-off-by: Chia-I Wu Reviewed-by: Christian König Fixes: 52c6a62c64fac ("drm/amdgpu: add interface for editing a foreign process's priority v3") --- drivers/gpu/drm/amd/

Re: [PATCH] drm/amdgpu: add a missing lock for AMDGPU_SCHED

2023-04-25 Thread Chia-I Wu
On Tue, Apr 25, 2023 at 9:58 PM Greg KH wrote: > > On Tue, Apr 25, 2023 at 05:48:27PM -0700, Chia-I Wu wrote: > > Signed-off-by: Chia-I Wu > > Cc: sta...@vger.kernel.org > > I know I can not take patches without any changelog text at all, maybe > the DRM developers a

[PATCH v2] drm/amdgpu: add a missing lock for AMDGPU_SCHED

2023-04-25 Thread Chia-I Wu
mgr->ctx_handles should be protected by mgr->lock. v2: improve commit message Signed-off-by: Chia-I Wu Cc: sta...@vger.kernel.org --- drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sche

Re: [PATCH] drm/amdgpu: add a missing lock for AMDGPU_SCHED

2023-04-25 Thread Chia-I Wu
--- > > From: amd-gfx On Behalf Of Chia- > > I Wu > > Sent: Wednesday, April 26, 2023 8:48 AM > > To: dri-de...@lists.freedesktop.org > > Cc: Pan, Xinhui ; linux-ker...@vger.kernel.org; > > sta...@vger.kernel.org; amd-gfx@lists.freedesktop.org; Daniel

[PATCH] drm/amdgpu: add a missing lock for AMDGPU_SCHED

2023-04-25 Thread Chia-I Wu
Signed-off-by: Chia-I Wu Cc: sta...@vger.kernel.org --- drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_sched.c index e9b45089a28a6..863b2a34b2d64

[PATCH] drm/amdkfd: fix potential kgd_mem UAFs

2023-03-08 Thread Chia-I Wu
kgd_mem should be accessed with p->mutex locked, or it could have been freed by kfd_ioctl_free_memory_of_gpu. Signed-off-by: Chia-I Wu --- drivers/gpu/drm/amd/amdkfd/kfd_chardev.c | 16 ++-- 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/amd

[PATCH] drm/amdkfd: fix a potential double free in pqm_create_queue

2023-03-07 Thread Chia-I Wu
Set *q to NULL on errors, otherwise pqm_create_queue would free it again. Signed-off-by: Chia-I Wu --- drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process_queue_manager.c b/drivers