lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <474488ce-75a1-06d9-768a-66008648c70e@amd.com>
Date:   Tue, 2 Apr 2019 17:40:54 +0000
From:   "Kuehling, Felix" <Felix.Kuehling@....com>
To:     "Paul E. McKenney" <paulmck@...ux.ibm.com>,
        "rcu@...r.kernel.org" <rcu@...r.kernel.org>
CC:     "peterz@...radead.org" <peterz@...radead.org>,
        "fweisbec@...il.com" <fweisbec@...il.com>,
        "jiangshanlai@...il.com" <jiangshanlai@...il.com>,
        "dri-devel@...ts.freedesktop.org" <dri-devel@...ts.freedesktop.org>,
        "oleg@...hat.com" <oleg@...hat.com>,
        "dhowells@...hat.com" <dhowells@...hat.com>,
        "edumazet@...gle.com" <edumazet@...gle.com>,
        "joel@...lfernandes.org" <joel@...lfernandes.org>,
        "mingo@...nel.org" <mingo@...nel.org>,
        "Zhou, David(ChunMing)" <David1.Zhou@....com>,
        "amd-gfx@...ts.freedesktop.org" <amd-gfx@...ts.freedesktop.org>,
        David Airlie <airlied@...ux.ie>,
        "dipankar@...ibm.com" <dipankar@...ibm.com>,
        "josh@...htriplett.org" <josh@...htriplett.org>,
        "rostedt@...dmis.org" <rostedt@...dmis.org>,
        Tejun Heo <tj@...nel.org>,
        "mathieu.desnoyers@...icios.com" <mathieu.desnoyers@...icios.com>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        Oded Gabbay <oded.gabbay@...il.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Daniel Vetter <daniel@...ll.ch>,
        "Deucher, Alexander" <Alexander.Deucher@....com>,
        "akpm@...ux-foundation.org" <akpm@...ux-foundation.org>
Subject: Re: [PATCH RFC tip/core/rcu 3/4] drivers/gpu/drm/amd: Dynamically
 allocate kfd_processes_srcu

On 2019-04-02 10:29 a.m., Paul E. McKenney wrote:
> Having DEFINE_SRCU() or DEFINE_STATIC_SRCU() in a loadable module
> requires that the size of the reserved region be increased, which is
> not something we really want to be doing.  This commit therefore removes
> the DEFINE_STATIC_SRCU() from drivers/gpu/drm/amd/amdkfd/kfd_process.c in
> favor of defining kfd_processes_srcu as a simple srcu_struct, initializing
> it in amdgpu_amdkfd_init(), and cleaning it up in amdgpu_amdkfd_fini().
>
> Reported-by: kbuild test robot <lkp@...el.com>
> Signed-off-by: Paul E. McKenney <paulmck@...ux.ibm.com>
> Tested-by: kbuild test robot <lkp@...el.com>
> Cc: Oded Gabbay <oded.gabbay@...il.com>
> Cc: Alex Deucher <alexander.deucher@....com>
> Cc: "Christian König" <christian.koenig@....com
> Cc: "David (ChunMing) Zhou" <David1.Zhou@....com>
> Cc: David Airlie <airlied@...ux.ie>
> Cc: Daniel Vetter <daniel@...ll.ch>
> Cc: Tejun Heo <tj@...nel.org>
> Cc: <dri-devel@...ts.freedesktop.org>
> Cc: <amd-gfx@...ts.freedesktop.org>
> ---
>   drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 5 +++++
>   drivers/gpu/drm/amd/amdkfd/kfd_process.c   | 2 +-
>   2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
> index fe1d7368c1e6..eadb20dee867 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c
> @@ -28,6 +28,8 @@
>   #include <linux/module.h>
>   #include <linux/dma-buf.h>
>   
> +extern struct srcu_struct kfd_processes_srcu;
> +
>   static const unsigned int compute_vmid_bitmap = 0xFF00;
>   
>   /* Total memory size in system memory and all GPU VRAM. Used to
> @@ -40,6 +42,8 @@ int amdgpu_amdkfd_init(void)
>   	struct sysinfo si;
>   	int ret;
>   
> +	ret = init_srcu_struct(&kfd_processes_srcu);
> +	WARN_ON(ret);

kfd_processes_srcu only exists if kfd_process.c is compiled in. That 
depends on CONFIG_HSA_AMD. So this should at least move into #ifdef a 
few lines below.

However, it would be cleaner to move this initialization into kfd_init 
in kfd_module.c, or better yet, into kfd_process_create_wq in 
kfd_process.c. Then kfd_process_create_wq should be renamed to something 
more generic, such as kfd_process_init.


>   	si_meminfo(&si);
>   	amdgpu_amdkfd_total_mem_size = si.totalram - si.totalhigh;
>   	amdgpu_amdkfd_total_mem_size *= si.mem_unit;
> @@ -57,6 +61,7 @@ int amdgpu_amdkfd_init(void)
>   void amdgpu_amdkfd_fini(void)
>   {
>   	kgd2kfd_exit();
> +	cleanup_srcu_struct(&kfd_processes_srcu);

Similarly, this would be cleaner in kfd_exit in kfd_module.c or 
kfd_process_destroy_wq in kfd_process.c, with that function similarly 
renamed to kfd_process_fini.

I'm attaching a revised patch. It's only compile tested.

Regards,
   Felix


>   }
>   
>   void amdgpu_amdkfd_device_probe(struct amdgpu_device *adev)
> diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_process.c b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> index 4bdae78bab8e..98b694068b8a 100644
> --- a/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> +++ b/drivers/gpu/drm/amd/amdkfd/kfd_process.c
> @@ -47,7 +47,7 @@ struct mm_struct;
>   DEFINE_HASHTABLE(kfd_processes_table, KFD_PROCESS_TABLE_SIZE);
>   static DEFINE_MUTEX(kfd_processes_mutex);
>   
> -DEFINE_SRCU(kfd_processes_srcu);
> +struct srcu_struct kfd_processes_srcu;
>   
>   /* For process termination handling */
>   static struct workqueue_struct *kfd_process_wq;

View attachment "0001-drivers-gpu-drm-amd-Dynamically-allocate-kfd_process.patch" of type "text/x-patch" (4696 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ