linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] RDMA/hfi1: stop using seq_get_buf in _driver_stats_seq_show
@ 2021-08-10 15:17 Christoph Hellwig
  2021-08-11 16:54 ` Marciniszyn, Mike
  2021-08-19 14:40 ` Jason Gunthorpe
  0 siblings, 2 replies; 3+ messages in thread
From: Christoph Hellwig @ 2021-08-10 15:17 UTC (permalink / raw)
  To: mike.marciniszyn, dennis.dalessandro, dledford, jgg; +Cc: linux-rdma

Just use seq_write to copy the stats into the seq_file buffer instead
of poking holes into the seq_file abstraction.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/infiniband/hw/hfi1/debugfs.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/infiniband/hw/hfi1/debugfs.c b/drivers/infiniband/hw/hfi1/debugfs.c
index 2ced236e1553..250079bca68e 100644
--- a/drivers/infiniband/hw/hfi1/debugfs.c
+++ b/drivers/infiniband/hw/hfi1/debugfs.c
@@ -1358,7 +1358,7 @@ static void _driver_stats_seq_stop(struct seq_file *s, void *v)
 {
 }
 
-static u64 hfi1_sps_ints(void)
+static void hfi1_sps_show_ints(struct seq_file *s)
 {
 	unsigned long index, flags;
 	struct hfi1_devdata *dd;
@@ -1369,24 +1369,19 @@ static u64 hfi1_sps_ints(void)
 		sps_ints += get_all_cpu_total(dd->int_counter);
 	}
 	xa_unlock_irqrestore(&hfi1_dev_table, flags);
-	return sps_ints;
+	seq_write(s, &sps_ints, sizeof(u64));
 }
 
 static int _driver_stats_seq_show(struct seq_file *s, void *v)
 {
 	loff_t *spos = v;
-	char *buffer;
 	u64 *stats = (u64 *)&hfi1_stats;
-	size_t sz = seq_get_buf(s, &buffer);
 
-	if (sz < sizeof(u64))
-		return SEQ_SKIP;
 	/* special case for interrupts */
 	if (*spos == 0)
-		*(u64 *)buffer = hfi1_sps_ints();
+		hfi1_sps_show_ints(s);
 	else
-		*(u64 *)buffer = stats[*spos];
-	seq_commit(s,  sizeof(u64));
+		seq_write(s, stats + *spos, sizeof(u64));
 	return 0;
 }
 
-- 
2.30.2


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

* RE: [PATCH] RDMA/hfi1: stop using seq_get_buf in _driver_stats_seq_show
  2021-08-10 15:17 [PATCH] RDMA/hfi1: stop using seq_get_buf in _driver_stats_seq_show Christoph Hellwig
@ 2021-08-11 16:54 ` Marciniszyn, Mike
  2021-08-19 14:40 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Marciniszyn, Mike @ 2021-08-11 16:54 UTC (permalink / raw)
  To: Christoph Hellwig, Dalessandro, Dennis, dledford, jgg; +Cc: linux-rdma

> Subject: [PATCH] RDMA/hfi1: stop using seq_get_buf in
> _driver_stats_seq_show
> 
> Just use seq_write to copy the stats into the seq_file buffer instead of
> poking holes into the seq_file abstraction.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  drivers/infiniband/hw/hfi1/debugfs.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)

Patch looks ok to me and it tests ok too!

Reviewed-by: Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
Tested-by: Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>

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

* Re: [PATCH] RDMA/hfi1: stop using seq_get_buf in _driver_stats_seq_show
  2021-08-10 15:17 [PATCH] RDMA/hfi1: stop using seq_get_buf in _driver_stats_seq_show Christoph Hellwig
  2021-08-11 16:54 ` Marciniszyn, Mike
@ 2021-08-19 14:40 ` Jason Gunthorpe
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Gunthorpe @ 2021-08-19 14:40 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: mike.marciniszyn, dennis.dalessandro, dledford, linux-rdma

On Tue, Aug 10, 2021 at 05:17:11PM +0200, Christoph Hellwig wrote:
> Just use seq_write to copy the stats into the seq_file buffer instead
> of poking holes into the seq_file abstraction.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Reviewed-by: Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
> Tested-by: Mike Marciniszyn <mike.marciniszyn@cornelisnetworks.com>
> ---
>  drivers/infiniband/hw/hfi1/debugfs.c | 13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)

Applied to for-next, thanks

Jason

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

end of thread, other threads:[~2021-08-19 14:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-10 15:17 [PATCH] RDMA/hfi1: stop using seq_get_buf in _driver_stats_seq_show Christoph Hellwig
2021-08-11 16:54 ` Marciniszyn, Mike
2021-08-19 14:40 ` Jason Gunthorpe

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