qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alistair Francis <alistair23@gmail.com>
To: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Cc: qemu-devel@nongnu.org, alex.bennee@linaro.org,
	peter.maydell@linaro.org, "Bin Meng" <bmeng.cn@gmail.com>,
	palmer@dabbelt.com, liwei1518@gmail.com,
	zhiwei_liu@linux.alibaba.com, qemu-riscv@nongnu.org,
	"Alistair Francis" <Alistair.Francis@wdc.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Marc-André Lureau" <marcandre.lureau@redhat.com>,
	atishp@rivosinc.com, dbarboza@ventanamicro.com,
	"Thomas Huth" <thuth@redhat.com>
Subject: Re: [PATCH v4 2/2] hw/char: sifive_uart: Print uart characters async
Date: Wed, 11 Sep 2024 11:53:19 +1000	[thread overview]
Message-ID: <CAKmqyKP4zBLKdPzFQ2Z136y3zztGOWYLCWAcB0St+9PNyrGPtg@mail.gmail.com> (raw)
In-Reply-To: <1eadf79e-ffe3-4d46-93a8-bebebf38e03c@ilande.co.uk>

On Wed, Sep 11, 2024 at 6:35 AM Mark Cave-Ayland
<mark.cave-ayland@ilande.co.uk> wrote:
>
> On 10/09/2024 05:54, Alistair Francis wrote:
>
> > The current approach of using qemu_chr_fe_write() and ignoring the
> > return values results in dropped characters [1].
> >
> > Let's update the SiFive UART to use a async sifive_uart_xmit() function
> > to transmit the characters and apply back pressure to the guest with
> > the SIFIVE_UART_TXFIFO_FULL status.
> >
> > This should avoid dropped characters and more realisticly model the
> > hardware.
>
> Does the UART work reliably using the fifo8_*_bufptr() functions? One of the

I haven't noticed any issues.

> motivations for my recent Fifo8 series is that these functions don't handle the
> wraparound correctly, unlike the fifo8_*_buf() functions in my recent Fifo8 series
> which do. This was the cause of Phil's async issue in
> https://mail.gnu.org/archive/html/qemu-devel/2024-07/msg05028.html.

I'm not sure if it matters here

    characters = fifo8_peek_bufptr(&s->tx_fifo,
                                   fifo8_num_used(&s->tx_fifo), &numptr);
    ret = qemu_chr_fe_write(&s->chr, characters, numptr);

    if (ret >= 0) {
        /* We wrote the data, actually pop the fifo */
        fifo8_pop_bufptr(&s->tx_fifo, ret, NULL);
    }

I don't care how many characters are returned from
fifo8_peek_bufptr(), I'll just write them and then pop that number
with fifo8_pop_bufptr()

If fifo8_is_empty() isn't empty I re-add the watcher for qemu_chr_fe_add_watch()

Alistair


  reply	other threads:[~2024-09-11  1:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-10  4:54 [PATCH v4 0/2] riscv: char: Avoid dropped charecters Alistair Francis
2024-09-10  4:54 ` [PATCH v4 1/2] hw/char: riscv_htif: Use blocking qemu_chr_fe_write_all Alistair Francis
2024-09-10  7:16   ` Philippe Mathieu-Daudé
2024-09-10  4:54 ` [PATCH v4 2/2] hw/char: sifive_uart: Print uart characters async Alistair Francis
2024-09-10  7:16   ` Philippe Mathieu-Daudé
2024-09-10 20:34   ` Mark Cave-Ayland
2024-09-11  1:53     ` Alistair Francis [this message]
2024-10-17 13:22 ` [PATCH v4 0/2] riscv: char: Avoid dropped charecters Thomas Huth
2024-10-21  3:44   ` Alistair Francis

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=CAKmqyKP4zBLKdPzFQ2Z136y3zztGOWYLCWAcB0St+9PNyrGPtg@mail.gmail.com \
    --to=alistair23@gmail.com \
    --cc=Alistair.Francis@wdc.com \
    --cc=alex.bennee@linaro.org \
    --cc=atishp@rivosinc.com \
    --cc=bmeng.cn@gmail.com \
    --cc=dbarboza@ventanamicro.com \
    --cc=liwei1518@gmail.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=mark.cave-ayland@ilande.co.uk \
    --cc=palmer@dabbelt.com \
    --cc=pbonzini@redhat.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-riscv@nongnu.org \
    --cc=thuth@redhat.com \
    --cc=zhiwei_liu@linux.alibaba.com \
    /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;
as well as URLs for NNTP newsgroup(s).