* [Qemu-devel] hw/serial.c: Xmit fifo never used
@ 2010-05-26 10:07 Frank Mehnert
2010-05-26 10:32 ` [Qemu-devel] " Jan Kiszka
2010-05-28 14:31 ` [Qemu-devel] " Paul Brook
0 siblings, 2 replies; 8+ messages in thread
From: Frank Mehnert @ 2010-05-26 10:07 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1149 bytes --]
Hi,
the xmit fifo of the serial device is never used. If qemu_chr_write()
fails (interface currently not able to send characters) then the
transmit_timer should be engaged to try to send the current character
from the fifo again after some time. The code is
} else if (qemu_chr_write(s->chr, &s->tsr, 1) != 1) {
if ((s->tsr_retry > 0) && (s->tsr_retry <= MAX_XMIT_RETRY)) {
s->tsr_retry++;
qemu_mod_timer(s->transmit_timer,
new_xmit_ts + s->char_transmit_time);
return;
}
...
}
The problem is that this path is never used as tsr_retry is never > 0
initially. So if qemu_chr_write() fails, we never try again but drop
the character.
I assume the correct condition would be '>= 0', that is
...
if ((s->tsr_retry >= 0) && (s->tsr_retry <= MAX_XMIT_RETRY)) {
s->tsr_retry++;
...
Kind regards,
Frank
--
Dr.-Ing. Frank Mehnert
Sitz der Gesellschaft:
Sun Microsystems GmbH, Sonnenallee 1, 85551 Kirchheim-Heimstetten
Amtsgericht München: HRB 161028
Geschäftsführer: Jürgen Kunz
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Qemu-devel] Re: hw/serial.c: Xmit fifo never used
2010-05-26 10:07 [Qemu-devel] hw/serial.c: Xmit fifo never used Frank Mehnert
@ 2010-05-26 10:32 ` Jan Kiszka
2010-05-26 11:06 ` Frank Mehnert
2010-05-28 14:31 ` [Qemu-devel] " Paul Brook
1 sibling, 1 reply; 8+ messages in thread
From: Jan Kiszka @ 2010-05-26 10:32 UTC (permalink / raw)
To: Frank Mehnert; +Cc: qemu-devel, Stefano Stabellini
Frank Mehnert wrote:
> Hi,
>
> the xmit fifo of the serial device is never used. If qemu_chr_write()
> fails (interface currently not able to send characters) then the
> transmit_timer should be engaged to try to send the current character
> from the fifo again after some time. The code is
>
> } else if (qemu_chr_write(s->chr, &s->tsr, 1) != 1) {
> if ((s->tsr_retry > 0) && (s->tsr_retry <= MAX_XMIT_RETRY)) {
> s->tsr_retry++;
> qemu_mod_timer(s->transmit_timer,
> new_xmit_ts + s->char_transmit_time);
> return;
> }
> ...
> }
>
> The problem is that this path is never used as tsr_retry is never > 0
> initially. So if qemu_chr_write() fails, we never try again but drop
> the character.
>
> I assume the correct condition would be '>= 0', that is
>
> ...
> if ((s->tsr_retry >= 0) && (s->tsr_retry <= MAX_XMIT_RETRY)) {
> s->tsr_retry++;
> ...
Makes sense, patch welcome.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] Re: hw/serial.c: Xmit fifo never used
2010-05-26 10:32 ` [Qemu-devel] " Jan Kiszka
@ 2010-05-26 11:06 ` Frank Mehnert
2010-05-26 11:16 ` Jan Kiszka
0 siblings, 1 reply; 8+ messages in thread
From: Frank Mehnert @ 2010-05-26 11:06 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1.1: Type: text/plain, Size: 536 bytes --]
On Wednesday 26 May 2010, Jan Kiszka wrote:
> Frank Mehnert wrote:
> > I assume the correct condition would be '>= 0', that is
> >
> > ...
> > if ((s->tsr_retry >= 0) && (s->tsr_retry <= MAX_XMIT_RETRY)) {
> > s->tsr_retry++;
> > ...
>
> Makes sense, patch welcome.
Attached.
Kind regards,
Frank
--
Dr.-Ing. Frank Mehnert
Sitz der Gesellschaft:
Sun Microsystems GmbH, Sonnenallee 1, 85551 Kirchheim-Heimstetten
Amtsgericht München: HRB 161028
Geschäftsführer: Jürgen Kunz
[-- Attachment #1.2: patch_hw_serial --]
[-- Type: text/x-diff, Size: 608 bytes --]
diff --git a/hw/serial.c b/hw/serial.c
index 9102edb..0b1550b 100644
--- a/hw/serial.c
+++ b/hw/serial.c
@@ -327,7 +327,7 @@ static void serial_xmit(void *opaque)
/* in loopback mode, say that we just received a char */
serial_receive1(s, &s->tsr, 1);
} else if (qemu_chr_write(s->chr, &s->tsr, 1) != 1) {
- if ((s->tsr_retry > 0) && (s->tsr_retry <= MAX_XMIT_RETRY)) {
+ if ((s->tsr_retry >= 0) && (s->tsr_retry <= MAX_XMIT_RETRY)) {
s->tsr_retry++;
qemu_mod_timer(s->transmit_timer, new_xmit_ts + s->char_transmit_time);
return;
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [Qemu-devel] Re: hw/serial.c: Xmit fifo never used
2010-05-26 11:06 ` Frank Mehnert
@ 2010-05-26 11:16 ` Jan Kiszka
2010-05-26 11:42 ` Stefano Stabellini
0 siblings, 1 reply; 8+ messages in thread
From: Jan Kiszka @ 2010-05-26 11:16 UTC (permalink / raw)
To: Frank Mehnert; +Cc: qemu-devel
Frank Mehnert wrote:
> On Wednesday 26 May 2010, Jan Kiszka wrote:
>> Frank Mehnert wrote:
>>> I assume the correct condition would be '>= 0', that is
>>>
>>> ...
>>> if ((s->tsr_retry >= 0) && (s->tsr_retry <= MAX_XMIT_RETRY)) {
>>> s->tsr_retry++;
>>> ...
>> Makes sense, patch welcome.
>
> Attached.
Signed-off, subject, and description please. And I would keep Stefano as
the original author of this feature in CC. A cross-check by him might be
good as we enable a code path that was apparently dead so far.
Thanks,
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] Re: hw/serial.c: Xmit fifo never used
2010-05-26 11:16 ` Jan Kiszka
@ 2010-05-26 11:42 ` Stefano Stabellini
2010-05-26 20:06 ` Frank Mehnert
0 siblings, 1 reply; 8+ messages in thread
From: Stefano Stabellini @ 2010-05-26 11:42 UTC (permalink / raw)
To: Jan Kiszka; +Cc: qemu-devel@nongnu.org, Frank Mehnert
On Wed, 26 May 2010, Jan Kiszka wrote:
> Frank Mehnert wrote:
> > On Wednesday 26 May 2010, Jan Kiszka wrote:
> >> Frank Mehnert wrote:
> >>> I assume the correct condition would be '>= 0', that is
> >>>
> >>> ...
> >>> if ((s->tsr_retry >= 0) && (s->tsr_retry <= MAX_XMIT_RETRY)) {
> >>> s->tsr_retry++;
> >>> ...
> >> Makes sense, patch welcome.
> >
> > Attached.
>
> Signed-off, subject, and description please. And I would keep Stefano as
> the original author of this feature in CC. A cross-check by him might be
> good as we enable a code path that was apparently dead so far.
>
I think the patch is correct.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] Re: hw/serial.c: Xmit fifo never used
2010-05-26 11:42 ` Stefano Stabellini
@ 2010-05-26 20:06 ` Frank Mehnert
2010-05-27 8:21 ` Jan Kiszka
0 siblings, 1 reply; 8+ messages in thread
From: Frank Mehnert @ 2010-05-26 20:06 UTC (permalink / raw)
To: qemu-devel; +Cc: Jan Kiszka, Stefano Stabellini
On Wednesday 26 May 2010, Stefano Stabellini wrote:
> I think the patch is correct.
serial: fixed bug which prevented the use of the xmit fifo
Signed-off-by: Frank Mehnert <frank.mehnert@sun.com>
---
hw/serial.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/hw/serial.c b/hw/serial.c
index 9102edb..0b1550b 100644
--- a/hw/serial.c
+++ b/hw/serial.c
@@ -327,7 +327,7 @@ static void serial_xmit(void *opaque)
/* in loopback mode, say that we just received a char */
serial_receive1(s, &s->tsr, 1);
} else if (qemu_chr_write(s->chr, &s->tsr, 1) != 1) {
- if ((s->tsr_retry > 0) && (s->tsr_retry <= MAX_XMIT_RETRY)) {
+ if ((s->tsr_retry >= 0) && (s->tsr_retry <= MAX_XMIT_RETRY)) {
s->tsr_retry++;
qemu_mod_timer(s->transmit_timer, new_xmit_ts +
s->char_transmit_time);
return;
--
1.5.6.5
Hope this is now the correct format.
Kind regards,
Frank
--
Dr.-Ing. Frank Mehnert
Sitz der Gesellschaft:
Sun Microsystems GmbH, Sonnenallee 1, 85551 Kirchheim-Heimstetten
Amtsgericht München: HRB 161028
Geschäftsführer: Jürgen Kunz
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] Re: hw/serial.c: Xmit fifo never used
2010-05-26 20:06 ` Frank Mehnert
@ 2010-05-27 8:21 ` Jan Kiszka
0 siblings, 0 replies; 8+ messages in thread
From: Jan Kiszka @ 2010-05-27 8:21 UTC (permalink / raw)
To: Frank Mehnert; +Cc: qemu-devel@nongnu.org, Stefano Stabellini
Frank Mehnert wrote:
> On Wednesday 26 May 2010, Stefano Stabellini wrote:
>> I think the patch is correct.
>
> serial: fixed bug which prevented the use of the xmit fifo
>
> Signed-off-by: Frank Mehnert <frank.mehnert@sun.com>
> ---
> hw/serial.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/hw/serial.c b/hw/serial.c
> index 9102edb..0b1550b 100644
> --- a/hw/serial.c
> +++ b/hw/serial.c
> @@ -327,7 +327,7 @@ static void serial_xmit(void *opaque)
> /* in loopback mode, say that we just received a char */
> serial_receive1(s, &s->tsr, 1);
> } else if (qemu_chr_write(s->chr, &s->tsr, 1) != 1) {
> - if ((s->tsr_retry > 0) && (s->tsr_retry <= MAX_XMIT_RETRY)) {
> + if ((s->tsr_retry >= 0) && (s->tsr_retry <= MAX_XMIT_RETRY)) {
> s->tsr_retry++;
> qemu_mod_timer(s->transmit_timer, new_xmit_ts +
> s->char_transmit_time);
> return;
> --
> 1.5.6.5
>
>
>
> Hope this is now the correct format.
Really close: Without "[PATCH]" prefix in the subject line there is the
risk that no maintainer will find your patch. Moreover, your mail client
wrapped long lines.
Jan
--
Siemens AG, Corporate Technology, CT T DE IT 1
Corporate Competence Center Embedded Linux
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [Qemu-devel] hw/serial.c: Xmit fifo never used
2010-05-26 10:07 [Qemu-devel] hw/serial.c: Xmit fifo never used Frank Mehnert
2010-05-26 10:32 ` [Qemu-devel] " Jan Kiszka
@ 2010-05-28 14:31 ` Paul Brook
1 sibling, 0 replies; 8+ messages in thread
From: Paul Brook @ 2010-05-28 14:31 UTC (permalink / raw)
To: qemu-devel; +Cc: Frank Mehnert
> The problem is that this path is never used as tsr_retry is never > 0
> initially. So if qemu_chr_write() fails, we never try again but drop
qemu_chr_write is a blocking interface. It should only fail if an
unrecoverable error occurs. In that case there's noting useful we can do, and
no reason to retry.
Paul
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2010-05-28 14:31 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-26 10:07 [Qemu-devel] hw/serial.c: Xmit fifo never used Frank Mehnert
2010-05-26 10:32 ` [Qemu-devel] " Jan Kiszka
2010-05-26 11:06 ` Frank Mehnert
2010-05-26 11:16 ` Jan Kiszka
2010-05-26 11:42 ` Stefano Stabellini
2010-05-26 20:06 ` Frank Mehnert
2010-05-27 8:21 ` Jan Kiszka
2010-05-28 14:31 ` [Qemu-devel] " Paul Brook
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).