mbox series

[0/2] system: Fix handling of '-serial none -serial something'

Message ID 20240122163607.459769-1-peter.maydell@linaro.org
Headers show
Series system: Fix handling of '-serial none -serial something' | expand

Message

Peter Maydell Jan. 22, 2024, 4:36 p.m. UTC
(This patchset fixes a bug reported by Bohdan Kostiv at
https://lore.kernel.org/qemu-devel/CAA3Sv1LQ8yDUNLCB5WqLVZjsHffrU0uSbL_YYJW_m+Db2PhEeQ@mail.gmail.com/
 -- my patch 1 avoids a bug in his suggested change, and
patch 2 is new, improving the documentation.)

Currently if the user passes multiple -serial options on the command
line, we mostly treat those as applying to the different serial
devices in order, so that for example
 -serial stdio -serial file:filename
will connect the first serial port to stdio and the second to the
named file.

The exception to this is the '-serial none' serial device type.  This
means "don't allocate this serial device", but a bug means that
following -serial options are not correctly handled, so that
 -serial none -serial stdio
has the unexpected effect that stdio is connected to the first serial
port, not the second.

This is a very long-standing bug that dates back at least as far as
commit 998bbd74b9d81 from 2009.
        
It's possible that some users have commandlines that mistakenly
include a previously-redundant '-serial none'; those users can
simply delete that option in order to produce a command line that
has the same effect on both old and new QEMU. We can mention this
in the release notes.

Our documentation for -serial none and -serial null was also a
bit lacking; I've provided a patch here which tries to improve it.

thanks
-- PMM

Peter Maydell (2):
  system/vl.c: Fix handling of '-serial none -serial something'
  qemu-options.hx: Improve -serial option documentation

 system/vl.c     | 22 +++++++++++++---------
 qemu-options.hx | 14 +++++++++++---
 2 files changed, 24 insertions(+), 12 deletions(-)

Comments

Peter Maydell Feb. 1, 2024, 1:35 p.m. UTC | #1
On Mon, 22 Jan 2024 at 16:36, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> (This patchset fixes a bug reported by Bohdan Kostiv at
> https://lore.kernel.org/qemu-devel/CAA3Sv1LQ8yDUNLCB5WqLVZjsHffrU0uSbL_YYJW_m+Db2PhEeQ@mail.gmail.com/
>  -- my patch 1 avoids a bug in his suggested change, and
> patch 2 is new, improving the documentation.)
>
> Currently if the user passes multiple -serial options on the command
> line, we mostly treat those as applying to the different serial
> devices in order, so that for example
>  -serial stdio -serial file:filename
> will connect the first serial port to stdio and the second to the
> named file.
>
> The exception to this is the '-serial none' serial device type.  This
> means "don't allocate this serial device", but a bug means that
> following -serial options are not correctly handled, so that
>  -serial none -serial stdio
> has the unexpected effect that stdio is connected to the first serial
> port, not the second.

I'll take this series via target-arm.next.

thanks
-- PMM