public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Rasmus Villemoes <ravi@prevas.dk>
To: Simon Glass <sjg@chromium.org>
Cc: u-boot@lists.denx.de,  Stefan Roese <sr@denx.de>,
	 Tom Rini <trini@konsulko.com>
Subject: Re: [PATCH 1/4] serial: fix circular rx buffer edge case
Date: Wed, 09 Oct 2024 13:03:08 +0200	[thread overview]
Message-ID: <87a5fd5yj7.fsf@prevas.dk> (raw)
In-Reply-To: <CAFLszTi37m5b1T03NnB21OTBgqd1dre+o-6AjjsQvUmY4vnN0g@mail.gmail.com> (Simon Glass's message of "Tue, 8 Oct 2024 19:51:06 -0600")

Simon Glass <sjg@chromium.org> writes:

> On Thu, 3 Oct 2024 at 08:10, Rasmus Villemoes <ravi@prevas.dk> wrote:
>>
>>  drivers/serial/serial-uclass.c | 10 ++++++----
>>  include/serial.h               |  4 ++--
>>  2 files changed, 8 insertions(+), 6 deletions(-)
>
> Reviewed-by: Simon Glass <sjg@chromium.org>
>
> Perhaps we should use membuff, like in other cases, since it has some tests?

I didn't know about that till just now. But no, it seems to suffer from
the same basic defect of losing one slot, and while it may handle it
correctly, I don't like to introduce more uses of that model, and
open-coding the single putc/getc that we need here is really not that
hard.

Also, which tests? I don't see membuff mentioned anywhere under test/,
but perhaps it's implicitly through the console recording testing?

I just had a quick peek in the implementation, and membuff_makecontig()
seems to be buggy: the second memcpy() must also be a memmove() (suppose
size==32, head==30, tail==10; then the memcpy() does a 10-byte
overlap...). It has no users and never has had, so it doesn't matter
too much.

Rasmus

  reply	other threads:[~2024-10-09 11:03 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-03 14:10 [PATCH 0/4] some serial rx buffer patches Rasmus Villemoes
2024-10-03 14:10 ` [PATCH 1/4] serial: fix circular rx buffer edge case Rasmus Villemoes
2024-10-09  1:51   ` Simon Glass
2024-10-09 11:03     ` Rasmus Villemoes [this message]
2024-10-17 23:23       ` Simon Glass
2024-10-03 14:10 ` [PATCH 2/4] serial: do not overwrite not-consumed characters in rx buffer Rasmus Villemoes
2024-10-09  1:51   ` Simon Glass
2024-10-03 14:10 ` [PATCH 3/4] serial: add build-time sanity check of CONFIG_SERIAL_RX_BUFFER_SIZE Rasmus Villemoes
2024-10-09  1:51   ` Simon Glass
2024-10-03 14:10 ` [PATCH 4/4] serial: embed the rx buffer in struct serial_dev_priv Rasmus Villemoes
2024-10-09  1:51   ` Simon Glass
2024-10-17  2:22 ` [PATCH 0/4] some serial rx buffer patches Tom Rini

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=87a5fd5yj7.fsf@prevas.dk \
    --to=ravi@prevas.dk \
    --cc=sjg@chromium.org \
    --cc=sr@denx.de \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    /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