* [Qemu-devel] [PATCH bugfix v1 1/1] char/serial: Fix emptyness check
@ 2014-02-11 6:49 Peter Crosthwaite
2014-02-11 9:55 ` Dr. David Alan Gilbert
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Peter Crosthwaite @ 2014-02-11 6:49 UTC (permalink / raw)
To: qemu-devel; +Cc: mkletzan, peter.maydell, edgari, mjt, dgilbert
This was guarding against a full fifo rather than an empty fifo when
popping. Fix.
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
---
hw/char/serial.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/char/serial.c b/hw/char/serial.c
index 27dab7d..6d3b5af 100644
--- a/hw/char/serial.c
+++ b/hw/char/serial.c
@@ -225,7 +225,7 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
if (s->tsr_retry <= 0) {
if (s->fcr & UART_FCR_FE) {
- s->tsr = fifo8_is_full(&s->xmit_fifo) ?
+ s->tsr = fifo8_is_empty(&s->xmit_fifo) ?
0 : fifo8_pop(&s->xmit_fifo);
if (!s->xmit_fifo.num) {
s->lsr |= UART_LSR_THRE;
--
1.8.5.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH bugfix v1 1/1] char/serial: Fix emptyness check
2014-02-11 6:49 [Qemu-devel] [PATCH bugfix v1 1/1] char/serial: Fix emptyness check Peter Crosthwaite
@ 2014-02-11 9:55 ` Dr. David Alan Gilbert
2014-02-11 12:38 ` [Qemu-devel] [PATCH bugfix v1 1/1] char/serial: Fix emptynesscheckk Alex Bennée
2014-02-11 10:25 ` [Qemu-devel] [PATCH bugfix v1 1/1] char/serial: Fix emptyness check Martin Kletzander
2014-02-11 10:29 ` Michael Tokarev
2 siblings, 1 reply; 6+ messages in thread
From: Dr. David Alan Gilbert @ 2014-02-11 9:55 UTC (permalink / raw)
To: Peter Crosthwaite; +Cc: mkletzan, peter.maydell, edgari, mjt, qemu-devel
* Peter Crosthwaite (peter.crosthwaite@xilinx.com) wrote:
> This was guarding against a full fifo rather than an empty fifo when
> popping. Fix.
>
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
I think this brings it back to how it was on the old FIFO code.
>
> hw/char/serial.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/char/serial.c b/hw/char/serial.c
> index 27dab7d..6d3b5af 100644
> --- a/hw/char/serial.c
> +++ b/hw/char/serial.c
> @@ -225,7 +225,7 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
>
> if (s->tsr_retry <= 0) {
> if (s->fcr & UART_FCR_FE) {
> - s->tsr = fifo8_is_full(&s->xmit_fifo) ?
> + s->tsr = fifo8_is_empty(&s->xmit_fifo) ?
> 0 : fifo8_pop(&s->xmit_fifo);
> if (!s->xmit_fifo.num) {
> s->lsr |= UART_LSR_THRE;
> --
> 1.8.5.4
>
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH bugfix v1 1/1] char/serial: Fix emptyness check
2014-02-11 6:49 [Qemu-devel] [PATCH bugfix v1 1/1] char/serial: Fix emptyness check Peter Crosthwaite
2014-02-11 9:55 ` Dr. David Alan Gilbert
@ 2014-02-11 10:25 ` Martin Kletzander
2014-02-11 10:29 ` Michael Tokarev
2 siblings, 0 replies; 6+ messages in thread
From: Martin Kletzander @ 2014-02-11 10:25 UTC (permalink / raw)
To: Peter Crosthwaite; +Cc: peter.maydell, edgari, mjt, qemu-devel, dgilbert
[-- Attachment #1: Type: text/plain, Size: 991 bytes --]
On Mon, Feb 10, 2014 at 10:49:35PM -0800, Peter Crosthwaite wrote:
> This was guarding against a full fifo rather than an empty fifo when
> popping. Fix.
>
> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> ---
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
With this patch qemu doesn't crash in my use-case.
>
> hw/char/serial.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/char/serial.c b/hw/char/serial.c
> index 27dab7d..6d3b5af 100644
> --- a/hw/char/serial.c
> +++ b/hw/char/serial.c
> @@ -225,7 +225,7 @@ static gboolean serial_xmit(GIOChannel *chan, GIOCondition cond, void *opaque)
>
> if (s->tsr_retry <= 0) {
> if (s->fcr & UART_FCR_FE) {
> - s->tsr = fifo8_is_full(&s->xmit_fifo) ?
> + s->tsr = fifo8_is_empty(&s->xmit_fifo) ?
> 0 : fifo8_pop(&s->xmit_fifo);
> if (!s->xmit_fifo.num) {
> s->lsr |= UART_LSR_THRE;
> --
> 1.8.5.4
>
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH bugfix v1 1/1] char/serial: Fix emptyness check
2014-02-11 6:49 [Qemu-devel] [PATCH bugfix v1 1/1] char/serial: Fix emptyness check Peter Crosthwaite
2014-02-11 9:55 ` Dr. David Alan Gilbert
2014-02-11 10:25 ` [Qemu-devel] [PATCH bugfix v1 1/1] char/serial: Fix emptyness check Martin Kletzander
@ 2014-02-11 10:29 ` Michael Tokarev
2 siblings, 0 replies; 6+ messages in thread
From: Michael Tokarev @ 2014-02-11 10:29 UTC (permalink / raw)
To: Peter Crosthwaite
Cc: peter.maydell, qemu-trivial, qemu-devel, dgilbert, edgari, mkletzan
11.02.2014 10:49, Peter Crosthwaite wrote:
> This was guarding against a full fifo rather than an empty fifo when
> popping. Fix.
I've applied this to qemu-trivial for now, if no one will pick it up
before the next -trivial pull, -- because the original change were
merged using -trivial too.
I also compared this with the previous code in this area, and it looks
like this is the right fix. So you can add my
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
too.
Thank you!
/mjt
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH bugfix v1 1/1] char/serial: Fix emptynesscheckk
2014-02-11 9:55 ` Dr. David Alan Gilbert
@ 2014-02-11 12:38 ` Alex Bennée
2014-02-11 12:41 ` Dr. David Alan Gilbert
0 siblings, 1 reply; 6+ messages in thread
From: Alex Bennée @ 2014-02-11 12:38 UTC (permalink / raw)
To: Dr. David Alan Gilbert
Cc: peter.maydell, Peter Crosthwaite, mjt, qemu-devel, edgari, mkletzan
Dr. David Alan Gilbert <dgilbert@redhat.com> writes:
> * Peter Crosthwaite (peter.crosthwaite@xilinx.com) wrote:
>> This was guarding against a full fifo rather than an empty fifo when
>> popping. Fix.
>>
>> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
>> ---
>
> Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
>
> I think this brings it back to how it was on the old FIFO code.
This does make me wonder why it was changed? Was there another crashing
case it fixed?
--
Alex Bennée
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PATCH bugfix v1 1/1] char/serial: Fix emptynesscheckk
2014-02-11 12:38 ` [Qemu-devel] [PATCH bugfix v1 1/1] char/serial: Fix emptynesscheckk Alex Bennée
@ 2014-02-11 12:41 ` Dr. David Alan Gilbert
0 siblings, 0 replies; 6+ messages in thread
From: Dr. David Alan Gilbert @ 2014-02-11 12:41 UTC (permalink / raw)
To: Alex Benn?e
Cc: peter.maydell, Peter Crosthwaite, mjt, qemu-devel, edgari, mkletzan
* Alex Benn?e (alex.bennee@linaro.org) wrote:
>
> Dr. David Alan Gilbert <dgilbert@redhat.com> writes:
>
> > * Peter Crosthwaite (peter.crosthwaite@xilinx.com) wrote:
> >> This was guarding against a full fifo rather than an empty fifo when
> >> popping. Fix.
> >>
> >> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
> >> ---
> >
> > Reviewed-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
> >
> > I think this brings it back to how it was on the old FIFO code.
>
> This does make me wonder why it was changed? Was there another crashing
> case it fixed?
The old serial code had it's own FIFO implementation, and that was
removed so that we had one less FIFO in the codebase; the problem
was that the old one in the serial code just returned 0 when empty,
the shared one aborts.
Dave
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-02-11 12:41 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-11 6:49 [Qemu-devel] [PATCH bugfix v1 1/1] char/serial: Fix emptyness check Peter Crosthwaite
2014-02-11 9:55 ` Dr. David Alan Gilbert
2014-02-11 12:38 ` [Qemu-devel] [PATCH bugfix v1 1/1] char/serial: Fix emptynesscheckk Alex Bennée
2014-02-11 12:41 ` Dr. David Alan Gilbert
2014-02-11 10:25 ` [Qemu-devel] [PATCH bugfix v1 1/1] char/serial: Fix emptyness check Martin Kletzander
2014-02-11 10:29 ` Michael Tokarev
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.