public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Cyril Hrubis <chrubis@suse.cz>
To: Petr Vorel <pvorel@suse.cz>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [RFC][PATCH 1/2] runtest/ipc: Enable named pipes on non-blocking IO
Date: Tue, 8 Apr 2025 20:37:26 +0200	[thread overview]
Message-ID: <Z_Vs5oeKp1KJo0fx@yuki.lan> (raw)
In-Reply-To: <20250403101912.459507-2-pvorel@suse.cz>

Hi!
> Tests were disabled from the start (edab67b3a0 in 2001) due EAGAIN.
> Tests are working now even on very old SLE12-SP3 based 4.4 kernel,
> therefore enable them.

My guess is that it much more depends on number of CPUs. It's more
likely that reader/write would starve on single CPU system.

But I've spend quite a bit of time reading the tlibio.c code (after I've
cleaned up the messy ifdefs) and the test (by default) passes method =
0. Which means that for write we do:

                while (1) {
                        if (((ret = write(fd, buffer, size)) == -1)
                            && errno != EAGAIN && errno != EINTR) {
                                sprintf(Errormsg,
                                        "%s/%d write(%d, buf, %d) ret:-1, errno=%d %s",
                                        __FILE__, __LINE__, fd, size, errno,
                                        strerror(errno));
                                return -errno;
                        }

                        if (ret != -1) {
                                if (ret != size) {
                                        sprintf(Errormsg,
                                                "%s/%d write(%d, buf, %d) returned=%d",
                                                __FILE__, __LINE__,
                                                fd, size, ret);
                                        size -= ret;
                                        buffer += ret;
                                        totally_written += ret;
                                } else {
                                        if (Debug_level > 1)
                                                printf
                                                    ("DEBUG %s/%d: write completed without error (ret %d)\n",
                                                     __FILE__, __LINE__, ret);

                                        return totally_written + ret;
                                }
                        }
                        wait4sync_io(fd, 0);
                }


And wait4sync_io() does select() to wait for the file descriptor to
became ready for reading. The corresponding part that reads look
similar. So it at least looks like the code properly handles the EAGAIN
case in the tlibio.c library and that it should be safe to enable the
non-blocking case.

Acked-by: Cyril Hrubis <chrubis@suse.cz>

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  parent reply	other threads:[~2025-04-08 18:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-03 10:19 [LTP] [RFC][PATCH 0/2] Merge runtest files Petr Vorel
2025-04-03 10:19 ` [LTP] [RFC][PATCH 1/2] runtest/ipc: Enable named pipes on non-blocking IO Petr Vorel
2025-04-06  2:55   ` Li Wang via ltp
2025-04-08 18:37   ` Cyril Hrubis [this message]
2025-04-03 10:19 ` [LTP] [RFC][PATCH 2/2] runtest: Move ipc into syscalls Petr Vorel
2025-04-06  3:01   ` Li Wang via ltp
2025-04-07 12:15     ` Petr Vorel
2025-04-07 12:19     ` Petr Vorel
2025-04-17  9:22   ` Cyril Hrubis
2025-04-17 11:14     ` Petr Vorel
2025-04-03 11:33 ` [LTP] [RFC][PATCH 0/2] Merge runtest files Andrea Cervesato via ltp
2025-04-03 15:47   ` Cyril Hrubis
2025-04-06  2:52     ` Li Wang via ltp
2025-04-06  2:43 ` Li Wang via ltp

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z_Vs5oeKp1KJo0fx@yuki.lan \
    --to=chrubis@suse.cz \
    --cc=ltp@lists.linux.it \
    --cc=pvorel@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox