Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH RFC] net: hns3: add a module parameter wq_unbound
@ 2021-07-20 8:34 Yufeng Mo
2021-07-20 9:01 ` Leon Romanovsky
0 siblings, 1 reply; 3+ messages in thread
From: Yufeng Mo @ 2021-07-20 8:34 UTC (permalink / raw)
To: davem, kuba
Cc: netdev, shenjian15, lipeng321, yisen.zhuang, linyunsheng,
zhangjiaran, huangguangbin2, chenhao288, salil.mehta, moyufeng,
linuxarm, linuxarm
To meet the requirements of different scenarios, the WQ_UNBOUND
flag of the workqueue is transferred as a module parameter. Users
can flexibly configure the usage mode as required.
Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
---
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 10 +++++++++-
drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 10 +++++++++-
2 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
index dd3354a..9816592 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
@@ -76,6 +76,10 @@ static struct hnae3_ae_algo ae_algo;
static struct workqueue_struct *hclge_wq;
+static unsigned int wq_unbound;
+module_param(wq_unbound, uint, 0400);
+MODULE_PARM_DESC(wq_unbound, "Specifies WQ_UNBOUND flag for the workqueue, non-zero value takes effect");
+
static const struct pci_device_id ae_algo_pci_tbl[] = {
{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_GE), 0},
{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE), 0},
@@ -12936,7 +12940,11 @@ static int hclge_init(void)
{
pr_info("%s is initializing\n", HCLGE_NAME);
- hclge_wq = alloc_workqueue("%s", 0, 0, HCLGE_NAME);
+ if (wq_unbound)
+ hclge_wq = alloc_workqueue("%s", WQ_UNBOUND, 0, HCLGE_NAME);
+ else
+ hclge_wq = alloc_workqueue("%s", 0, 0, HCLGE_NAME);
+
if (!hclge_wq) {
pr_err("%s: failed to create workqueue\n", HCLGE_NAME);
return -ENOMEM;
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
index 52eaf82..85f6772 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
@@ -21,6 +21,10 @@ static struct hnae3_ae_algo ae_algovf;
static struct workqueue_struct *hclgevf_wq;
+static unsigned int wq_unbound;
+module_param(wq_unbound, uint, 0400);
+MODULE_PARM_DESC(wq_unbound, "Specifies WQ_UNBOUND flag for the workqueue, non-zero value takes effect");
+
static const struct pci_device_id ae_algovf_pci_tbl[] = {
{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_VF), 0},
{PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_RDMA_DCB_PFC_VF),
@@ -3855,7 +3859,11 @@ static int hclgevf_init(void)
{
pr_info("%s is initializing\n", HCLGEVF_NAME);
- hclgevf_wq = alloc_workqueue("%s", 0, 0, HCLGEVF_NAME);
+ if (wq_unbound)
+ hclgevf_wq = alloc_workqueue("%s", WQ_UNBOUND, 0, HCLGEVF_NAME);
+ else
+ hclgevf_wq = alloc_workqueue("%s", 0, 0, HCLGEVF_NAME);
+
if (!hclgevf_wq) {
pr_err("%s: failed to create workqueue\n", HCLGEVF_NAME);
return -ENOMEM;
--
2.8.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH RFC] net: hns3: add a module parameter wq_unbound
2021-07-20 8:34 [PATCH RFC] net: hns3: add a module parameter wq_unbound Yufeng Mo
@ 2021-07-20 9:01 ` Leon Romanovsky
2021-07-20 9:29 ` moyufeng
0 siblings, 1 reply; 3+ messages in thread
From: Leon Romanovsky @ 2021-07-20 9:01 UTC (permalink / raw)
To: Yufeng Mo
Cc: davem, kuba, netdev, shenjian15, lipeng321, yisen.zhuang,
linyunsheng, zhangjiaran, huangguangbin2, chenhao288,
salil.mehta, linuxarm, linuxarm
On Tue, Jul 20, 2021 at 04:34:57PM +0800, Yufeng Mo wrote:
> To meet the requirements of different scenarios, the WQ_UNBOUND
> flag of the workqueue is transferred as a module parameter. Users
> can flexibly configure the usage mode as required.
>
> Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
> ---
> drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 10 +++++++++-
> drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 10 +++++++++-
> 2 files changed, 18 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
> index dd3354a..9816592 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
> @@ -76,6 +76,10 @@ static struct hnae3_ae_algo ae_algo;
>
> static struct workqueue_struct *hclge_wq;
>
> +static unsigned int wq_unbound;
> +module_param(wq_unbound, uint, 0400);
> +MODULE_PARM_DESC(wq_unbound, "Specifies WQ_UNBOUND flag for the workqueue, non-zero value takes effect");
Nice, but no. We don't like module parameters for such a basic thing.
Somehow all other NIC drivers in the world works without it and hns3
will success too.
Thanks
> +
> static const struct pci_device_id ae_algo_pci_tbl[] = {
> {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_GE), 0},
> {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE), 0},
> @@ -12936,7 +12940,11 @@ static int hclge_init(void)
> {
> pr_info("%s is initializing\n", HCLGE_NAME);
>
> - hclge_wq = alloc_workqueue("%s", 0, 0, HCLGE_NAME);
> + if (wq_unbound)
> + hclge_wq = alloc_workqueue("%s", WQ_UNBOUND, 0, HCLGE_NAME);
> + else
> + hclge_wq = alloc_workqueue("%s", 0, 0, HCLGE_NAME);
> +
> if (!hclge_wq) {
> pr_err("%s: failed to create workqueue\n", HCLGE_NAME);
> return -ENOMEM;
> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
> index 52eaf82..85f6772 100644
> --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
> @@ -21,6 +21,10 @@ static struct hnae3_ae_algo ae_algovf;
>
> static struct workqueue_struct *hclgevf_wq;
>
> +static unsigned int wq_unbound;
> +module_param(wq_unbound, uint, 0400);
> +MODULE_PARM_DESC(wq_unbound, "Specifies WQ_UNBOUND flag for the workqueue, non-zero value takes effect");
> +
> static const struct pci_device_id ae_algovf_pci_tbl[] = {
> {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_VF), 0},
> {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_RDMA_DCB_PFC_VF),
> @@ -3855,7 +3859,11 @@ static int hclgevf_init(void)
> {
> pr_info("%s is initializing\n", HCLGEVF_NAME);
>
> - hclgevf_wq = alloc_workqueue("%s", 0, 0, HCLGEVF_NAME);
> + if (wq_unbound)
> + hclgevf_wq = alloc_workqueue("%s", WQ_UNBOUND, 0, HCLGEVF_NAME);
> + else
> + hclgevf_wq = alloc_workqueue("%s", 0, 0, HCLGEVF_NAME);
> +
> if (!hclgevf_wq) {
> pr_err("%s: failed to create workqueue\n", HCLGEVF_NAME);
> return -ENOMEM;
> --
> 2.8.1
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH RFC] net: hns3: add a module parameter wq_unbound
2021-07-20 9:01 ` Leon Romanovsky
@ 2021-07-20 9:29 ` moyufeng
0 siblings, 0 replies; 3+ messages in thread
From: moyufeng @ 2021-07-20 9:29 UTC (permalink / raw)
To: Leon Romanovsky
Cc: davem, kuba, netdev, shenjian15, lipeng321, yisen.zhuang,
linyunsheng, zhangjiaran, huangguangbin2, chenhao288,
salil.mehta, linuxarm, linuxarm
On 2021/7/20 17:01, Leon Romanovsky wrote:
> On Tue, Jul 20, 2021 at 04:34:57PM +0800, Yufeng Mo wrote:
>> To meet the requirements of different scenarios, the WQ_UNBOUND
>> flag of the workqueue is transferred as a module parameter. Users
>> can flexibly configure the usage mode as required.
>>
>> Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
>> ---
>> drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c | 10 +++++++++-
>> drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c | 10 +++++++++-
>> 2 files changed, 18 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
>> index dd3354a..9816592 100644
>> --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
>> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c
>> @@ -76,6 +76,10 @@ static struct hnae3_ae_algo ae_algo;
>>
>> static struct workqueue_struct *hclge_wq;
>>
>> +static unsigned int wq_unbound;
>> +module_param(wq_unbound, uint, 0400);
>> +MODULE_PARM_DESC(wq_unbound, "Specifies WQ_UNBOUND flag for the workqueue, non-zero value takes effect");
>
> Nice, but no. We don't like module parameters for such a basic thing.
> Somehow all other NIC drivers in the world works without it and hns3
> will success too.
>
> Thanks
>
Thanks for your comments. I'll change it to WQ_UNBOUND mode fixedly for
more reasonable workqueue scheduling in complex scenarios.
Thanks
>> +
>> static const struct pci_device_id ae_algo_pci_tbl[] = {
>> {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_GE), 0},
>> {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_25GE), 0},
>> @@ -12936,7 +12940,11 @@ static int hclge_init(void)
>> {
>> pr_info("%s is initializing\n", HCLGE_NAME);
>>
>> - hclge_wq = alloc_workqueue("%s", 0, 0, HCLGE_NAME);
>> + if (wq_unbound)
>> + hclge_wq = alloc_workqueue("%s", WQ_UNBOUND, 0, HCLGE_NAME);
>> + else
>> + hclge_wq = alloc_workqueue("%s", 0, 0, HCLGE_NAME);
>> +
>> if (!hclge_wq) {
>> pr_err("%s: failed to create workqueue\n", HCLGE_NAME);
>> return -ENOMEM;
>> diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
>> index 52eaf82..85f6772 100644
>> --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
>> +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.c
>> @@ -21,6 +21,10 @@ static struct hnae3_ae_algo ae_algovf;
>>
>> static struct workqueue_struct *hclgevf_wq;
>>
>> +static unsigned int wq_unbound;
>> +module_param(wq_unbound, uint, 0400);
>> +MODULE_PARM_DESC(wq_unbound, "Specifies WQ_UNBOUND flag for the workqueue, non-zero value takes effect");
>> +
>> static const struct pci_device_id ae_algovf_pci_tbl[] = {
>> {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_VF), 0},
>> {PCI_VDEVICE(HUAWEI, HNAE3_DEV_ID_RDMA_DCB_PFC_VF),
>> @@ -3855,7 +3859,11 @@ static int hclgevf_init(void)
>> {
>> pr_info("%s is initializing\n", HCLGEVF_NAME);
>>
>> - hclgevf_wq = alloc_workqueue("%s", 0, 0, HCLGEVF_NAME);
>> + if (wq_unbound)
>> + hclgevf_wq = alloc_workqueue("%s", WQ_UNBOUND, 0, HCLGEVF_NAME);
>> + else
>> + hclgevf_wq = alloc_workqueue("%s", 0, 0, HCLGEVF_NAME);
>> +
>> if (!hclgevf_wq) {
>> pr_err("%s: failed to create workqueue\n", HCLGEVF_NAME);
>> return -ENOMEM;
>> --
>> 2.8.1
>>
> .
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-07-20 9:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-20 8:34 [PATCH RFC] net: hns3: add a module parameter wq_unbound Yufeng Mo
2021-07-20 9:01 ` Leon Romanovsky
2021-07-20 9:29 ` moyufeng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).