Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Console mirrored to UART drops characters frequently #10

Open
rlippert opened this issue Jun 2, 2017 · 0 comments
Open

Console mirrored to UART drops characters frequently #10

rlippert opened this issue Jun 2, 2017 · 0 comments

Comments

@rlippert
Copy link

rlippert commented Jun 2, 2017

When executing something like 'ps aux' over the UART console, much of the output at the end get dropped or mangled and obmc-console-server reports write error: resource temporarily unavailable.

I tracked it down to write_buf_to_fd not properly handling EAGAIN/EWOULDBLOCK return code. This patch works around the issue:

diff --git a/util.c b/util.c
index d6e037a..cb190c8 100644
--- a/util.c
+++ b/util.c
@@ -15,6 +15,7 @@
  */
 
 #include <err.h>
+#include <errno.h>
 #include <unistd.h>
 
 #include "console-server.h"
@@ -27,6 +28,10 @@ int write_buf_to_fd(int fd, const uint8_t *buf, size_t len)
        for (pos = 0; pos < len; pos += rc) {
                rc = write(fd, buf + pos, len - pos);
                if (rc <= 0) {
+                       if (errno == EAGAIN) {
+                               rc = 0;
+                               continue;
+                       }
                        warn("Write error");
                        return -1;
                }

Unfortunately patching it this way makes all other consoles (e.g. obmc-console-client over ssh) output as slowly as the UART console because obmc-console-server is a single threaded app and this makes it block waiting for serial port to flush output.

I'm hoping this issue will be fixed by @jk-ozlabs commit series https://gerrit.openbmc-project.xyz/#/c/2322/1 but I haven't tested it yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant