diff options
author | Eduard-Gabriel Munteanu <maxdamage@aladin.ro> | 2007-07-16 02:38:51 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-07-16 12:05:38 -0400 |
commit | 89df6bfc04059716de2eb2fe529f05b3e124fafd (patch) | |
tree | 5f28a79bc65549f48e153f18b1692d9cf462c628 /arch/um/drivers | |
parent | e18eecb8b35703a5eea73ee2b45324262029e62c (diff) |
uml: DEBUG_SHIRQ fixes
DEBUG_SHIRQ generates spurious interrupts, triggering handlers such as
mconsole_interrupt() or line_interrupt(). They expect data to be available to
be read from their sockets/pipes, but in the case of spurious interrupts, the
host didn't actually send anything, so UML hangs in read() and friends.
Setting those fd's as O_NONBLOCK makes DEBUG_SHIRQ-enabled UML kernels boot
and run correctly.
Signed-off-by: Eduard-Gabriel Munteanu <maxdamage@aladin.ro>
Signed-off-by: Jeff Dike <jdike@linux.intel.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch/um/drivers')
-rw-r--r-- | arch/um/drivers/chan_user.c | 8 | ||||
-rw-r--r-- | arch/um/drivers/mconsole_user.c | 5 | ||||
-rw-r--r-- | arch/um/drivers/ubd_user.c | 6 | ||||
-rw-r--r-- | arch/um/drivers/xterm.c | 7 |
4 files changed, 23 insertions, 3 deletions
diff --git a/arch/um/drivers/chan_user.c b/arch/um/drivers/chan_user.c index 13f0bf852b2a..5d1289d33410 100644 --- a/arch/um/drivers/chan_user.c +++ b/arch/um/drivers/chan_user.c | |||
@@ -170,7 +170,13 @@ static int winch_tramp(int fd, struct tty_struct *tty, int *fd_out) | |||
170 | err = -EINVAL; | 170 | err = -EINVAL; |
171 | goto out_close; | 171 | goto out_close; |
172 | } | 172 | } |
173 | return err ; | 173 | |
174 | if (os_set_fd_block(*fd_out, 0)) { | ||
175 | printk("winch_tramp: failed to set thread_fd non-blocking.\n"); | ||
176 | goto out_close; | ||
177 | } | ||
178 | |||
179 | return err; | ||
174 | 180 | ||
175 | out_close: | 181 | out_close: |
176 | os_close_file(fds[1]); | 182 | os_close_file(fds[1]); |
diff --git a/arch/um/drivers/mconsole_user.c b/arch/um/drivers/mconsole_user.c index 62e5ad63181a..f31e71546e52 100644 --- a/arch/um/drivers/mconsole_user.c +++ b/arch/um/drivers/mconsole_user.c | |||
@@ -86,8 +86,9 @@ int mconsole_get_request(int fd, struct mc_request *req) | |||
86 | int len; | 86 | int len; |
87 | 87 | ||
88 | req->originlen = sizeof(req->origin); | 88 | req->originlen = sizeof(req->origin); |
89 | req->len = recvfrom(fd, &req->request, sizeof(req->request), 0, | 89 | req->len = recvfrom(fd, &req->request, sizeof(req->request), |
90 | (struct sockaddr *) req->origin, &req->originlen); | 90 | MSG_DONTWAIT, (struct sockaddr *) req->origin, |
91 | &req->originlen); | ||
91 | if (req->len < 0) | 92 | if (req->len < 0) |
92 | return 0; | 93 | return 0; |
93 | 94 | ||
diff --git a/arch/um/drivers/ubd_user.c b/arch/um/drivers/ubd_user.c index 4707b3f14c2f..41d254bd38df 100644 --- a/arch/um/drivers/ubd_user.c +++ b/arch/um/drivers/ubd_user.c | |||
@@ -43,6 +43,12 @@ int start_io_thread(unsigned long sp, int *fd_out) | |||
43 | kernel_fd = fds[0]; | 43 | kernel_fd = fds[0]; |
44 | *fd_out = fds[1]; | 44 | *fd_out = fds[1]; |
45 | 45 | ||
46 | err = os_set_fd_block(*fd_out, 0); | ||
47 | if (err) { | ||
48 | printk("start_io_thread - failed to set nonblocking I/O.\n"); | ||
49 | goto out_close; | ||
50 | } | ||
51 | |||
46 | pid = clone(io_thread, (void *) sp, CLONE_FILES | CLONE_VM | SIGCHLD, | 52 | pid = clone(io_thread, (void *) sp, CLONE_FILES | CLONE_VM | SIGCHLD, |
47 | NULL); | 53 | NULL); |
48 | if(pid < 0){ | 54 | if(pid < 0){ |
diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c index 571c2b3325d5..fe238e03a300 100644 --- a/arch/um/drivers/xterm.c +++ b/arch/um/drivers/xterm.c | |||
@@ -151,6 +151,13 @@ int xterm_open(int input, int output, int primary, void *d, | |||
151 | goto out; | 151 | goto out; |
152 | } | 152 | } |
153 | 153 | ||
154 | err = os_set_fd_block(new, 0); | ||
155 | if (err) { | ||
156 | printk("xterm_open : failed to set xterm descriptor " | ||
157 | "non-blocking, err = %d\n", -err); | ||
158 | goto out; | ||
159 | } | ||
160 | |||
154 | CATCH_EINTR(err = tcgetattr(new, &data->tt)); | 161 | CATCH_EINTR(err = tcgetattr(new, &data->tt)); |
155 | if(err){ | 162 | if(err){ |
156 | new = err; | 163 | new = err; |