Re: [PATCH 1/1] trace: Move readpos from seq_buf to trace_seq

From: Steven Rostedt
Date: Thu Oct 19 2023 - 18:10:55 EST


On Fri, 20 Oct 2023 05:59:36 +0800
kernel test robot <lkp@xxxxxxxxx> wrote:

> 3a161d99c43ce7 kernel/trace/seq_buf.c Steven Rostedt (Red Hat 2014-06-25 323) /**
> 9dbbc3b9d09d6d lib/seq_buf.c Zhen Lei 2021-07-07 324 * seq_buf_to_user - copy the sequence buffer to user space
> 3a161d99c43ce7 kernel/trace/seq_buf.c Steven Rostedt (Red Hat 2014-06-25 325) * @s: seq_buf descriptor
> 3a161d99c43ce7 kernel/trace/seq_buf.c Steven Rostedt (Red Hat 2014-06-25 326) * @ubuf: The userspace memory location to copy to
> 3a161d99c43ce7 kernel/trace/seq_buf.c Steven Rostedt (Red Hat 2014-06-25 327) * @cnt: The amount to copy

When you resend, I guess you should add the @start as well.

-- Steve

> 3a161d99c43ce7 kernel/trace/seq_buf.c Steven Rostedt (Red Hat 2014-06-25 328) *
> 3a161d99c43ce7 kernel/trace/seq_buf.c Steven Rostedt (Red Hat 2014-06-25 329) * Copies the sequence buffer into the userspace memory pointed to
> 3a161d99c43ce7 kernel/trace/seq_buf.c Steven Rostedt (Red Hat 2014-06-25 330) * by @ubuf. It starts from the last read position (@s->readpos)
> 3a161d99c43ce7 kernel/trace/seq_buf.c Steven Rostedt (Red Hat 2014-06-25 331) * and writes up to @cnt characters or till it reaches the end of
> 3a161d99c43ce7 kernel/trace/seq_buf.c Steven Rostedt (Red Hat 2014-06-25 332) * the content in the buffer (@s->len), which ever comes first.
> 3a161d99c43ce7 kernel/trace/seq_buf.c Steven Rostedt (Red Hat 2014-06-25 333) *
> 3a161d99c43ce7 kernel/trace/seq_buf.c Steven Rostedt (Red Hat 2014-06-25 334) * On success, it returns a positive number of the number of bytes
> 3a161d99c43ce7 kernel/trace/seq_buf.c Steven Rostedt (Red Hat 2014-06-25 335) * it copied.
> 3a161d99c43ce7 kernel/trace/seq_buf.c Steven Rostedt (Red Hat 2014-06-25 336) *
> 3a161d99c43ce7 kernel/trace/seq_buf.c Steven Rostedt (Red Hat 2014-06-25 337) * On failure it returns -EBUSY if all of the content in the
> 3a161d99c43ce7 kernel/trace/seq_buf.c Steven Rostedt (Red Hat 2014-06-25 338) * sequence has been already read, which includes nothing in the
> 3a161d99c43ce7 kernel/trace/seq_buf.c Steven Rostedt (Red Hat 2014-06-25 339) * sequence (@s->len == @s->readpos).
> 3a161d99c43ce7 kernel/trace/seq_buf.c Steven Rostedt (Red Hat 2014-06-25 340) *
> 3a161d99c43ce7 kernel/trace/seq_buf.c Steven Rostedt (Red Hat 2014-06-25 341) * Returns -EFAULT if the copy to userspace fails.
> 3a161d99c43ce7 kernel/trace/seq_buf.c Steven Rostedt (Red Hat 2014-06-25 342) */
> 9377093a882be0 lib/seq_buf.c Matthew Wilcox (Oracle 2023-10-19 343) int seq_buf_to_user(struct seq_buf *s, char __user *ubuf, size_t start, int cnt)
> 3a161d99c43ce7 kernel/trace/seq_buf.c Steven Rostedt (Red Hat 2014-06-25 @344) {
> 3a161d99c43ce7 kernel/trace/seq_buf.c Steven Rostedt (Red Hat 2014-06-25 345) int len;
> 3a161d99c43ce7 kernel/trace/seq_buf.c Steven Rostedt (Red Hat 2014-06-25 346) int ret;
> 3a161d99c43ce7 kernel/trace/seq_buf.c Steven Rostedt (Red Hat 2014-06-25 347)