dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] dmaengine: idxd: Fix default allowed read buffers value in group
@ 2023-01-27 19:28 Fenghua Yu
  2023-01-27 19:40 ` Dave Jiang
  2023-02-10  6:06 ` Vinod Koul
  0 siblings, 2 replies; 3+ messages in thread
From: Fenghua Yu @ 2023-01-27 19:28 UTC (permalink / raw)
  To: Vinod Koul, Dave Jiang
  Cc: linux-kernel, dmaengine, Fenghua Yu, Ramesh Thomas, Nikhil Rao

Currently default read buffers that is allowed in a group is 0.
grpcfg will be configured to max read buffers that IDXD can support if
the group's allowed read buffers value is 0. But 0 is an invalid
read buffers value and user may get confused when seeing the invalid
initial value 0 through sysfs interface.

To show only valid allowed read buffers value and eliminate confusion,
directly initialize the allowed read buffers to IDXD's max read buffers.
User still can change the value through sysfs interface.

Suggested-by: Ramesh Thomas <ramesh.thomas@intel.com>
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>
---
 drivers/dma/idxd/device.c | 12 ++++++------
 drivers/dma/idxd/init.c   |  5 +++++
 2 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
index 29dbb0f52e18..8d0e3aab2ad2 100644
--- a/drivers/dma/idxd/device.c
+++ b/drivers/dma/idxd/device.c
@@ -699,7 +699,11 @@ static void idxd_groups_clear_state(struct idxd_device *idxd)
 		group->num_engines = 0;
 		group->num_wqs = 0;
 		group->use_rdbuf_limit = false;
-		group->rdbufs_allowed = 0;
+		/*
+		 * The default value is the same as the value of
+		 * total read buffers in GRPCAP.
+		 */
+		group->rdbufs_allowed = idxd->max_rdbufs;
 		group->rdbufs_reserved = 0;
 		if (idxd->hw.version < DEVICE_VERSION_2 && !tc_override) {
 			group->tc_a = 1;
@@ -934,11 +938,7 @@ static void idxd_group_flags_setup(struct idxd_device *idxd)
 			group->grpcfg.flags.tc_b = group->tc_b;
 		group->grpcfg.flags.use_rdbuf_limit = group->use_rdbuf_limit;
 		group->grpcfg.flags.rdbufs_reserved = group->rdbufs_reserved;
-		if (group->rdbufs_allowed)
-			group->grpcfg.flags.rdbufs_allowed = group->rdbufs_allowed;
-		else
-			group->grpcfg.flags.rdbufs_allowed = idxd->max_rdbufs;
-
+		group->grpcfg.flags.rdbufs_allowed = group->rdbufs_allowed;
 		group->grpcfg.flags.desc_progress_limit = group->desc_progress_limit;
 		group->grpcfg.flags.batch_progress_limit = group->batch_progress_limit;
 	}
diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c
index 529ea09c9094..b2df604e8a5f 100644
--- a/drivers/dma/idxd/init.c
+++ b/drivers/dma/idxd/init.c
@@ -302,6 +302,11 @@ static int idxd_setup_groups(struct idxd_device *idxd)
 			group->tc_a = -1;
 			group->tc_b = -1;
 		}
+		/*
+		 * The default value is the same as the value of
+		 * total read buffers in GRPCAP.
+		 */
+		group->rdbufs_allowed = idxd->max_rdbufs;
 	}
 
 	return 0;
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] dmaengine: idxd: Fix default allowed read buffers value in group
  2023-01-27 19:28 [PATCH] dmaengine: idxd: Fix default allowed read buffers value in group Fenghua Yu
@ 2023-01-27 19:40 ` Dave Jiang
  2023-02-10  6:06 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Dave Jiang @ 2023-01-27 19:40 UTC (permalink / raw)
  To: Fenghua Yu, Vinod Koul; +Cc: linux-kernel, dmaengine, Ramesh Thomas, Nikhil Rao



On 1/27/23 12:28 PM, Fenghua Yu wrote:
> Currently default read buffers that is allowed in a group is 0.
> grpcfg will be configured to max read buffers that IDXD can support if
> the group's allowed read buffers value is 0. But 0 is an invalid
> read buffers value and user may get confused when seeing the invalid
> initial value 0 through sysfs interface.
> 
> To show only valid allowed read buffers value and eliminate confusion,
> directly initialize the allowed read buffers to IDXD's max read buffers.
> User still can change the value through sysfs interface.
> 
> Suggested-by: Ramesh Thomas <ramesh.thomas@intel.com>
> Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
> Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>

Reviewed-by: Dave Jiang <dave.jiang@intel.com>

> ---
>   drivers/dma/idxd/device.c | 12 ++++++------
>   drivers/dma/idxd/init.c   |  5 +++++
>   2 files changed, 11 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
> index 29dbb0f52e18..8d0e3aab2ad2 100644
> --- a/drivers/dma/idxd/device.c
> +++ b/drivers/dma/idxd/device.c
> @@ -699,7 +699,11 @@ static void idxd_groups_clear_state(struct idxd_device *idxd)
>   		group->num_engines = 0;
>   		group->num_wqs = 0;
>   		group->use_rdbuf_limit = false;
> -		group->rdbufs_allowed = 0;
> +		/*
> +		 * The default value is the same as the value of
> +		 * total read buffers in GRPCAP.
> +		 */
> +		group->rdbufs_allowed = idxd->max_rdbufs;
>   		group->rdbufs_reserved = 0;
>   		if (idxd->hw.version < DEVICE_VERSION_2 && !tc_override) {
>   			group->tc_a = 1;
> @@ -934,11 +938,7 @@ static void idxd_group_flags_setup(struct idxd_device *idxd)
>   			group->grpcfg.flags.tc_b = group->tc_b;
>   		group->grpcfg.flags.use_rdbuf_limit = group->use_rdbuf_limit;
>   		group->grpcfg.flags.rdbufs_reserved = group->rdbufs_reserved;
> -		if (group->rdbufs_allowed)
> -			group->grpcfg.flags.rdbufs_allowed = group->rdbufs_allowed;
> -		else
> -			group->grpcfg.flags.rdbufs_allowed = idxd->max_rdbufs;
> -
> +		group->grpcfg.flags.rdbufs_allowed = group->rdbufs_allowed;
>   		group->grpcfg.flags.desc_progress_limit = group->desc_progress_limit;
>   		group->grpcfg.flags.batch_progress_limit = group->batch_progress_limit;
>   	}
> diff --git a/drivers/dma/idxd/init.c b/drivers/dma/idxd/init.c
> index 529ea09c9094..b2df604e8a5f 100644
> --- a/drivers/dma/idxd/init.c
> +++ b/drivers/dma/idxd/init.c
> @@ -302,6 +302,11 @@ static int idxd_setup_groups(struct idxd_device *idxd)
>   			group->tc_a = -1;
>   			group->tc_b = -1;
>   		}
> +		/*
> +		 * The default value is the same as the value of
> +		 * total read buffers in GRPCAP.
> +		 */
> +		group->rdbufs_allowed = idxd->max_rdbufs;
>   	}
>   
>   	return 0;

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] dmaengine: idxd: Fix default allowed read buffers value in group
  2023-01-27 19:28 [PATCH] dmaengine: idxd: Fix default allowed read buffers value in group Fenghua Yu
  2023-01-27 19:40 ` Dave Jiang
@ 2023-02-10  6:06 ` Vinod Koul
  1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2023-02-10  6:06 UTC (permalink / raw)
  To: Fenghua Yu; +Cc: Dave Jiang, linux-kernel, dmaengine, Ramesh Thomas, Nikhil Rao

On 27-01-23, 11:28, Fenghua Yu wrote:
> Currently default read buffers that is allowed in a group is 0.
> grpcfg will be configured to max read buffers that IDXD can support if
> the group's allowed read buffers value is 0. But 0 is an invalid
> read buffers value and user may get confused when seeing the invalid
> initial value 0 through sysfs interface.
> 
> To show only valid allowed read buffers value and eliminate confusion,
> directly initialize the allowed read buffers to IDXD's max read buffers.
> User still can change the value through sysfs interface.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-02-10  6:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-27 19:28 [PATCH] dmaengine: idxd: Fix default allowed read buffers value in group Fenghua Yu
2023-01-27 19:40 ` Dave Jiang
2023-02-10  6:06 ` Vinod Koul

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).