[igt-dev] [PATCH] igt_kmod: handle EPIPE on kmsg

Chris Wilson chris at chris-wilson.co.uk
Sun Sep 29 09:21:08 UTC 2019


Quoting Lucas De Marchi (2019-09-28 01:16:09)
> If kmsg rotates due to a huge log, the read() will fail with EPIPE since
> the seek() we did is not valid anymore. When we get an EPIPE, the kernel
> will set our pointer to the last entry available, so just retry another
> read.
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi at intel.com>
> ---
>  lib/igt_kmod.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/lib/igt_kmod.c b/lib/igt_kmod.c
> index 01faca39..c3da4667 100644
> --- a/lib/igt_kmod.c
> +++ b/lib/igt_kmod.c
> @@ -391,8 +391,15 @@ static void kmsg_dump(int fd)
>                 if (r < 0) {
>                         if (errno == EINTR)
>                                 continue;
> +
> +                       if (errno == EPIPE) {
> +                               igt_warn("kmsg truncated: too many messages. You may want to increase log_buf_len in kmcdline\n");
> +                               continue;

devkmsg_read():

        if (user->seq < log_first_seq) {
                /* our last seen message is gone, return error and reset */
                user->idx = log_first_idx;
                user->seq = log_first_seq;
                ret = -EPIPE;
                logbuf_unlock_irq();
                goto out;
        }

so singleshot indeed.

Reviewed-by: Chris Wilson <chris at chris-wilson.co.uk>
-Chris


More information about the igt-dev mailing list