Skip to contentSkip to conversation

x86/resctrl: Fix kernel-doc in rdtgroup.c

PATCH Superseded Fabio M. De Francesco 2 participants 2 messages Jul 7, 2021 – Jul 19, 2021

Subsystems (2)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/resctrl: Fix kernel-doc in rdtgroup.c

Add description of undocumented parameters. Issues detected by scripts/kernel-doc.

---
 arch/x86/kernel/cpu/resctrl/rdtgroup.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
arch/x86/kernel/cpu/resctrl/rdtgroup.c +19 -0
index 01fd30e7829d..b5a30e57ce5f 100644
@@ -877,6 +877,9 @@ static int rdt_shareable_bits_show(struct kernfs_open_file *of,
 
 /**
  * rdt_bit_usage_show - Display current usage of resources
+ * @of: kernfs open file
+ * @seq: seq_file for kernfs
+ * @v: unused pointer to void
  *
  * A domain is a shared resource that can now be allocated differently. Here
  * we display the current regions of the domain as an annotated bitmask.
@@ -888,6 +891,8 @@ static int rdt_shareable_bits_show(struct kernfs_open_file *of,
  *   S - currently used and shareable by software only
  *   E - currently used exclusively by one resource group
  *   P - currently pseudo-locked by one resource group
+ *
+ * Return: 0 on success
  */
 static int rdt_bit_usage_show(struct kernfs_open_file *of,
 			      struct seq_file *seq, void *v)
@@ -1243,6 +1248,7 @@ bool rdtgroup_cbm_overlaps(struct rdt_resource *r, struct rdt_domain *d,
 
 /**
  * rdtgroup_mode_test_exclusive - Test if this resource group can be exclusive
+ * @rdtgrp: resource director technology group
  *
  * An exclusive resource group implies that there should be no sharing of
  * its allocated resources. At the time this group is considered to be
@@ -1283,7 +1289,12 @@ static bool rdtgroup_mode_test_exclusive(struct rdtgroup *rdtgrp)
 
 /**
  * rdtgroup_mode_write - Modify the resource group's mode
+ * @of: open file in kernfs
+ * @buf: input data buffer
+ * @nbytes: lenght of input data buffer
+ * @off: offset
  *
+ * Return: @nbytes on success, <0 on failure
  */
 static ssize_t rdtgroup_mode_write(struct kernfs_open_file *of,
 				   char *buf, size_t nbytes, loff_t off)
@@ -1367,6 +1378,8 @@ static ssize_t rdtgroup_mode_write(struct kernfs_open_file *of,
  *
  * @cbm is unsigned long, even if only 32 bits are used to make the
  * bitmap functions work correctly.
+ *
+ * Return: how many bytes are represented by the bitmask associated with the RDT domain.
  */
 unsigned int rdtgroup_cbm_to_size(struct rdt_resource *r,
 				  struct rdt_domain *d, unsigned long cbm)
@@ -1389,10 +1402,14 @@ unsigned int rdtgroup_cbm_to_size(struct rdt_resource *r,
 
 /**
  * rdtgroup_size_show - Display size in bytes of allocated regions
+ * @of: open file in kernfs
+ * @s: seq_file
+ * @v: unused pointer to void
  *
  * The "size" file mirrors the layout of the "schemata" file, printing the
  * size in bytes of each region instead of the capacity bitmask.
  *
+ * Return: 0 on success, <0 on failure
  */
 static int rdtgroup_size_show(struct kernfs_open_file *of,
 			      struct seq_file *s, void *v)
@@ -2618,6 +2635,8 @@ static int mkdir_mondata_all(struct kernfs_node *parent_kn,
  * resource group is initialized. The user can follow this with a
  * modification to the CBM if the default does not satisfy the
  * requirements.
+ *
+ * Return: A bitmap representing a valid contiguous CBM, 0 if @_val is only 0 filled
  */
 static u32 cbm_ensure_valid(u32 _val, struct rdt_resource *r)
 {
Signature · 1 line
2.32.0
maintainer
#1 lore raw

Hi Fabio,

Thank you very much for continuing these fixes.

Quoted 13 lines · Fabio M. De Francesco

Add description of undocumented parameters. Issues detected by scripts/kernel-doc.

---
  arch/x86/kernel/cpu/resctrl/rdtgroup.c | 19 +++++++++++++++++++
  1 file changed, 19 insertions(+)
arch/x86/kernel/cpu/resctrl/rdtgroup.c +0 -0
index 01fd30e7829d..b5a30e57ce5f 100644

arch/x86/kernel/cpu/resctrl/rdtgroup.c static int rdt_shareable_bits_show(struct kernfs_open_file *of, · line 880

Quoted 4 lines
arch/x86/kernel/cpu/resctrl/rdtgroup.c +1 -0
@@ -877,6 +877,9 @@ static int rdt_shareable_bits_show(struct kernfs_open_file *of,
 
  /**
   * rdt_bit_usage_show - Display current usage of resources
+ * @of: kernfs open file

This description just seems like a rewrite of the type. How about:
@of: pointer to opened "bit_usage" info file

arch/x86/kernel/cpu/resctrl/rdtgroup.c static int rdt_shareable_bits_show(struct kernfs_open_file *of, · line 881

Quoted 1 line
arch/x86/kernel/cpu/resctrl/rdtgroup.c +1 -0
+ * @seq: seq_file for kernfs

@seq: seq_file used to format output to "bit_usage"

arch/x86/kernel/cpu/resctrl/rdtgroup.c static int rdt_shareable_bits_show(struct kernfs_open_file *of, · line 895

Quoted 10 lines
arch/x86/kernel/cpu/resctrl/rdtgroup.c +3 -0
+ * @v: unused pointer to void
   *
   * A domain is a shared resource that can now be allocated differently. Here
   * we display the current regions of the domain as an annotated bitmask.
@@ -888,6 +891,8 @@ static int rdt_shareable_bits_show(struct kernfs_open_file *of,
   *   S - currently used and shareable by software only
   *   E - currently used exclusively by one resource group
   *   P - currently pseudo-locked by one resource group
+ *
+ * Return: 0 on success

This function always returns 0. It can just be:
Return: 0

arch/x86/kernel/cpu/resctrl/rdtgroup.c bool rdtgroup_cbm_overlaps(struct rdt_resource *r, struct rdt_domain *d, · line 1251

Quoted 8 lines
arch/x86/kernel/cpu/resctrl/rdtgroup.c +1 -0
   */
  static int rdt_bit_usage_show(struct kernfs_open_file *of,
  			      struct seq_file *seq, void *v)
@@ -1243,6 +1248,7 @@ bool rdtgroup_cbm_overlaps(struct rdt_resource *r, struct rdt_domain *d,
 
  /**
   * rdtgroup_mode_test_exclusive - Test if this resource group can be exclusive
+ * @rdtgrp: resource director technology group

Just "resource group" please.

arch/x86/kernel/cpu/resctrl/rdtgroup.c static bool rdtgroup_mode_test_exclusive(struct rdtgroup *rdtgrp) · line 1292

Quoted 8 lines
arch/x86/kernel/cpu/resctrl/rdtgroup.c +1 -0
   *
   * An exclusive resource group implies that there should be no sharing of
   * its allocated resources. At the time this group is considered to be
@@ -1283,7 +1289,12 @@ static bool rdtgroup_mode_test_exclusive(struct rdtgroup *rdtgrp)
 
  /**
   * rdtgroup_mode_write - Modify the resource group's mode
+ * @of: open file in kernfs

@of: pointer to opened "mode" file of a resource group

arch/x86/kernel/cpu/resctrl/rdtgroup.c static bool rdtgroup_mode_test_exclusive(struct rdtgroup *rdtgrp) · line 1293

Quoted 1 line
arch/x86/kernel/cpu/resctrl/rdtgroup.c +1 -0
+ * @buf: input data buffer

@buf: data from user space

arch/x86/kernel/cpu/resctrl/rdtgroup.c static bool rdtgroup_mode_test_exclusive(struct rdtgroup *rdtgrp) · line 1294

Quoted 1 line
arch/x86/kernel/cpu/resctrl/rdtgroup.c +1 -0
+ * @nbytes: lenght of input data buffer

lenght -> length

arch/x86/kernel/cpu/resctrl/rdtgroup.c static bool rdtgroup_mode_test_exclusive(struct rdtgroup *rdtgrp) · line 1295

Quoted 1 line
arch/x86/kernel/cpu/resctrl/rdtgroup.c +1 -0
+ * @off: offset

Just writing "offset" is quite cryptic. While an offset to a write may be intuitive I think it would be valuable to add that this is not used/supported.

arch/x86/kernel/cpu/resctrl/rdtgroup.c static ssize_t rdtgroup_mode_write(struct kernfs_open_file *of, · line 1383

Quoted 12 lines
arch/x86/kernel/cpu/resctrl/rdtgroup.c +3 -0
   *
+ * Return: @nbytes on success, <0 on failure
   */
  static ssize_t rdtgroup_mode_write(struct kernfs_open_file *of,
  				   char *buf, size_t nbytes, loff_t off)
@@ -1367,6 +1378,8 @@ static ssize_t rdtgroup_mode_write(struct kernfs_open_file *of,
   *
   * @cbm is unsigned long, even if only 32 bits are used to make the
   * bitmap functions work correctly.
+ *
+ * Return: how many bytes are represented by the bitmask associated with the RDT domain.
   */

Could you please change to "how many bytes of the cache are represented by @cbm"?

arch/x86/kernel/cpu/resctrl/rdtgroup.c unsigned int rdtgroup_cbm_to_size(struct rdt_resource *r, · line 1405

Quoted 7 lines
arch/x86/kernel/cpu/resctrl/rdtgroup.c +1 -0
  unsigned int rdtgroup_cbm_to_size(struct rdt_resource *r,
  				  struct rdt_domain *d, unsigned long cbm)
@@ -1389,10 +1402,14 @@ unsigned int rdtgroup_cbm_to_size(struct rdt_resource *r,
 
  /**
   * rdtgroup_size_show - Display size in bytes of allocated regions
+ * @of: open file in kernfs

@of: pointer to opened "size" file of a resource group

arch/x86/kernel/cpu/resctrl/rdtgroup.c unsigned int rdtgroup_cbm_to_size(struct rdt_resource *r, · line 1406

Quoted 1 line
arch/x86/kernel/cpu/resctrl/rdtgroup.c +1 -0
+ * @s: seq_file

@seq: seq_file used to format output to "size"

Quoted 10 lines
arch/x86/kernel/cpu/resctrl/rdtgroup.c +2 -0
+ * @v: unused pointer to void
   *
   * The "size" file mirrors the layout of the "schemata" file, printing the
   * size in bytes of each region instead of the capacity bitmask.
   *
+ * Return: 0 on success, <0 on failure
   */
  static int rdtgroup_size_show(struct kernfs_open_file *of,
  			      struct seq_file *s, void *v)

arch/x86/kernel/cpu/resctrl/rdtgroup.c static int mkdir_mondata_all(struct kernfs_node *parent_kn, · line 2640

Quoted 6 lines
arch/x86/kernel/cpu/resctrl/rdtgroup.c +2 -0
@@ -2618,6 +2635,8 @@ static int mkdir_mondata_all(struct kernfs_node *parent_kn,
   * resource group is initialized. The user can follow this with a
   * modification to the CBM if the default does not satisfy the
   * requirements.
+ *
+ * Return: A bitmap representing a valid contiguous CBM, 0 if @_val is only 0 filled
   */

A valid CBM is one that consists out of contiguous 1s. So perhaps this could be simplified as: "Return: A valid CBM, ..."

arch/x86/kernel/cpu/resctrl/rdtgroup.c static int mkdir_mondata_all(struct kernfs_node *parent_kn, · line 2642

Quoted 3 lines
arch/x86/kernel/cpu/resctrl/rdtgroup.c +0 -0
  static u32 cbm_ensure_valid(u32 _val, struct rdt_resource *r)
  {

Thank you very much

Reinette