2014-07-17 13:33:36

by Oded Gabbay

[permalink] [raw]
Subject: [PATCH v2 16/25] amdkfd: Add module parameter of scheduling policy

From: Ben Goz <[email protected]>

This patch adds a new parameter to the amdkfd driver. This parameter enables the user to select the scheduling policy of the CP. The choices are:

* CP Scheduling with support for over-subscription
* CP Scheduling without support for over-subscription
* Without CP Scheduling

Signed-off-by: Ben Goz <[email protected]>
Signed-off-by: Oded Gabbay <[email protected]>
---
drivers/gpu/drm/radeon/amdkfd/kfd_module.c | 4 ++++
drivers/gpu/drm/radeon/amdkfd/kfd_priv.h | 9 +++++++++
2 files changed, 13 insertions(+)

diff --git a/drivers/gpu/drm/radeon/amdkfd/kfd_module.c b/drivers/gpu/drm/radeon/amdkfd/kfd_module.c
index dc08f51..fe5e39d 100644
--- a/drivers/gpu/drm/radeon/amdkfd/kfd_module.c
+++ b/drivers/gpu/drm/radeon/amdkfd/kfd_module.c
@@ -46,6 +46,10 @@ static const struct kgd2kfd_calls kgd2kfd = {
.resume = kgd2kfd_resume,
};

+int sched_policy = KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION;
+module_param(sched_policy, int, S_IRUSR | S_IWUSR);
+MODULE_PARM_DESC(sched_policy, "Kernel cmdline parameter define the kfd scheduling policy");
+
bool kgd2kfd_init(unsigned interface_version,
const struct kfd2kgd_calls *f2g,
const struct kgd2kfd_calls **g2f)
diff --git a/drivers/gpu/drm/radeon/amdkfd/kfd_priv.h b/drivers/gpu/drm/radeon/amdkfd/kfd_priv.h
index 25f23c5..8be07a1 100644
--- a/drivers/gpu/drm/radeon/amdkfd/kfd_priv.h
+++ b/drivers/gpu/drm/radeon/amdkfd/kfd_priv.h
@@ -64,6 +64,15 @@
/* Macro for allocating structures */
#define kfd_alloc_struct(ptr_to_struct) ((typeof(ptr_to_struct)) kzalloc(sizeof(*ptr_to_struct), GFP_KERNEL))

+/* Kernel module parameter to specify the scheduling policy */
+extern int sched_policy;
+
+enum kfd_sched_policy {
+ KFD_SCHED_POLICY_HWS = 0,
+ KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION,
+ KFD_SCHED_POLICY_NO_HWS
+};
+
/*
* Large enough to hold the maximum usable pasid + 1.
* It must also be able to store the number of doorbells
--
1.9.1


2014-07-21 02:45:37

by Jerome Glisse

[permalink] [raw]
Subject: Re: [PATCH v2 16/25] amdkfd: Add module parameter of scheduling policy

On Thu, Jul 17, 2014 at 04:29:23PM +0300, Oded Gabbay wrote:
> From: Ben Goz <[email protected]>
>
> This patch adds a new parameter to the amdkfd driver. This parameter enables the user to select the scheduling policy of the CP. The choices are:
>
> * CP Scheduling with support for over-subscription
> * CP Scheduling without support for over-subscription
> * Without CP Scheduling

Is this property per process ? And again 80 chars line please.

>
> Signed-off-by: Ben Goz <[email protected]>
> Signed-off-by: Oded Gabbay <[email protected]>
> ---
> drivers/gpu/drm/radeon/amdkfd/kfd_module.c | 4 ++++
> drivers/gpu/drm/radeon/amdkfd/kfd_priv.h | 9 +++++++++
> 2 files changed, 13 insertions(+)
>
> diff --git a/drivers/gpu/drm/radeon/amdkfd/kfd_module.c b/drivers/gpu/drm/radeon/amdkfd/kfd_module.c
> index dc08f51..fe5e39d 100644
> --- a/drivers/gpu/drm/radeon/amdkfd/kfd_module.c
> +++ b/drivers/gpu/drm/radeon/amdkfd/kfd_module.c
> @@ -46,6 +46,10 @@ static const struct kgd2kfd_calls kgd2kfd = {
> .resume = kgd2kfd_resume,
> };
>
> +int sched_policy = KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION;
> +module_param(sched_policy, int, S_IRUSR | S_IWUSR);
> +MODULE_PARM_DESC(sched_policy, "Kernel cmdline parameter define the kfd scheduling policy");
> +
> bool kgd2kfd_init(unsigned interface_version,
> const struct kfd2kgd_calls *f2g,
> const struct kgd2kfd_calls **g2f)
> diff --git a/drivers/gpu/drm/radeon/amdkfd/kfd_priv.h b/drivers/gpu/drm/radeon/amdkfd/kfd_priv.h
> index 25f23c5..8be07a1 100644
> --- a/drivers/gpu/drm/radeon/amdkfd/kfd_priv.h
> +++ b/drivers/gpu/drm/radeon/amdkfd/kfd_priv.h
> @@ -64,6 +64,15 @@
> /* Macro for allocating structures */
> #define kfd_alloc_struct(ptr_to_struct) ((typeof(ptr_to_struct)) kzalloc(sizeof(*ptr_to_struct), GFP_KERNEL))
>
> +/* Kernel module parameter to specify the scheduling policy */
> +extern int sched_policy;
> +
> +enum kfd_sched_policy {
> + KFD_SCHED_POLICY_HWS = 0,
> + KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION,
> + KFD_SCHED_POLICY_NO_HWS
> +};
> +
> /*
> * Large enough to hold the maximum usable pasid + 1.
> * It must also be able to store the number of doorbells
> --
> 1.9.1
>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

2014-07-27 10:22:14

by Oded Gabbay

[permalink] [raw]
Subject: Re: [PATCH v2 16/25] amdkfd: Add module parameter of scheduling policy

On 21/07/14 05:45, Jerome Glisse wrote:
> On Thu, Jul 17, 2014 at 04:29:23PM +0300, Oded Gabbay wrote:
>> From: Ben Goz <[email protected]>
>>
>> This patch adds a new parameter to the amdkfd driver. This parameter enables the user to select the scheduling policy of the CP. The choices are:
>>
>> * CP Scheduling with support for over-subscription
>> * CP Scheduling without support for over-subscription
>> * Without CP Scheduling
>
> Is this property per process ?
No, this is the general scheduling mode for all of amdkfd.
The runlist that we feed to the GPU contains queues from all HSA processes.
Furthermore, the number of hardware queues is a total number of the GPU.
Therefore, there is no option to operate in different modes (and I see no point
in that).

Also, I see I forgot to write in the commit msg that the third option (without
CP Scheduling) is only for debug purposes and bringup of new H/W. As such, it is
_not_ guaranteed to work at all times on all H/W versions.
Added this is v3.

> And again 80 chars line please.
Fixed in v3.
Oded

>
>>
>> Signed-off-by: Ben Goz <[email protected]>
>> Signed-off-by: Oded Gabbay <[email protected]>
>> ---
>> drivers/gpu/drm/radeon/amdkfd/kfd_module.c | 4 ++++
>> drivers/gpu/drm/radeon/amdkfd/kfd_priv.h | 9 +++++++++
>> 2 files changed, 13 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/radeon/amdkfd/kfd_module.c b/drivers/gpu/drm/radeon/amdkfd/kfd_module.c
>> index dc08f51..fe5e39d 100644
>> --- a/drivers/gpu/drm/radeon/amdkfd/kfd_module.c
>> +++ b/drivers/gpu/drm/radeon/amdkfd/kfd_module.c
>> @@ -46,6 +46,10 @@ static const struct kgd2kfd_calls kgd2kfd = {
>> .resume = kgd2kfd_resume,
>> };
>>
>> +int sched_policy = KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION;
>> +module_param(sched_policy, int, S_IRUSR | S_IWUSR);
>> +MODULE_PARM_DESC(sched_policy, "Kernel cmdline parameter define the kfd scheduling policy");
>> +
>> bool kgd2kfd_init(unsigned interface_version,
>> const struct kfd2kgd_calls *f2g,
>> const struct kgd2kfd_calls **g2f)
>> diff --git a/drivers/gpu/drm/radeon/amdkfd/kfd_priv.h b/drivers/gpu/drm/radeon/amdkfd/kfd_priv.h
>> index 25f23c5..8be07a1 100644
>> --- a/drivers/gpu/drm/radeon/amdkfd/kfd_priv.h
>> +++ b/drivers/gpu/drm/radeon/amdkfd/kfd_priv.h
>> @@ -64,6 +64,15 @@
>> /* Macro for allocating structures */
>> #define kfd_alloc_struct(ptr_to_struct) ((typeof(ptr_to_struct)) kzalloc(sizeof(*ptr_to_struct), GFP_KERNEL))
>>
>> +/* Kernel module parameter to specify the scheduling policy */
>> +extern int sched_policy;
>> +
>> +enum kfd_sched_policy {
>> + KFD_SCHED_POLICY_HWS = 0,
>> + KFD_SCHED_POLICY_HWS_NO_OVERSUBSCRIPTION,
>> + KFD_SCHED_POLICY_NO_HWS
>> +};
>> +
>> /*
>> * Large enough to hold the maximum usable pasid + 1.
>> * It must also be able to store the number of doorbells
>> --
>> 1.9.1
>>
>> _______________________________________________
>> dri-devel mailing list
>> [email protected]
>> http://lists.freedesktop.org/mailman/listinfo/dri-devel