[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v2] tools/xl: fix channel configuration setting


  • To: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • From: Jürgen Groß <jgross@xxxxxxxx>
  • Date: Mon, 3 Mar 2025 11:17:14 +0100
  • Autocrypt: addr=jgross@xxxxxxxx; keydata= xsBNBFOMcBYBCACgGjqjoGvbEouQZw/ToiBg9W98AlM2QHV+iNHsEs7kxWhKMjrioyspZKOB ycWxw3ie3j9uvg9EOB3aN4xiTv4qbnGiTr3oJhkB1gsb6ToJQZ8uxGq2kaV2KL9650I1SJve dYm8Of8Zd621lSmoKOwlNClALZNew72NjJLEzTalU1OdT7/i1TXkH09XSSI8mEQ/ouNcMvIJ NwQpd369y9bfIhWUiVXEK7MlRgUG6MvIj6Y3Am/BBLUVbDa4+gmzDC9ezlZkTZG2t14zWPvx XP3FAp2pkW0xqG7/377qptDmrk42GlSKN4z76ELnLxussxc7I2hx18NUcbP8+uty4bMxABEB AAHNH0p1ZXJnZW4gR3Jvc3MgPGpncm9zc0BzdXNlLmNvbT7CwHkEEwECACMFAlOMcK8CGwMH CwkIBwMCAQYVCAIJCgsEFgIDAQIeAQIXgAAKCRCw3p3WKL8TL8eZB/9G0juS/kDY9LhEXseh mE9U+iA1VsLhgDqVbsOtZ/S14LRFHczNd/Lqkn7souCSoyWsBs3/wO+OjPvxf7m+Ef+sMtr0 G5lCWEWa9wa0IXx5HRPW/ScL+e4AVUbL7rurYMfwCzco+7TfjhMEOkC+va5gzi1KrErgNRHH kg3PhlnRY0Udyqx++UYkAsN4TQuEhNN32MvN0Np3WlBJOgKcuXpIElmMM5f1BBzJSKBkW0Jc Wy3h2Wy912vHKpPV/Xv7ZwVJ27v7KcuZcErtptDevAljxJtE7aJG6WiBzm+v9EswyWxwMCIO RoVBYuiocc51872tRGywc03xaQydB+9R7BHPzsBNBFOMcBYBCADLMfoA44MwGOB9YT1V4KCy vAfd7E0BTfaAurbG+Olacciz3yd09QOmejFZC6AnoykydyvTFLAWYcSCdISMr88COmmCbJzn sHAogjexXiif6ANUUlHpjxlHCCcELmZUzomNDnEOTxZFeWMTFF9Rf2k2F0Tl4E5kmsNGgtSa aMO0rNZoOEiD/7UfPP3dfh8JCQ1VtUUsQtT1sxos8Eb/HmriJhnaTZ7Hp3jtgTVkV0ybpgFg w6WMaRkrBh17mV0z2ajjmabB7SJxcouSkR0hcpNl4oM74d2/VqoW4BxxxOD1FcNCObCELfIS auZx+XT6s+CE7Qi/c44ibBMR7hyjdzWbABEBAAHCwF8EGAECAAkFAlOMcBYCGwwACgkQsN6d 1ii/Ey9D+Af/WFr3q+bg/8v5tCknCtn92d5lyYTBNt7xgWzDZX8G6/pngzKyWfedArllp0Pn fgIXtMNV+3t8Li1Tg843EXkP7+2+CQ98MB8XvvPLYAfW8nNDV85TyVgWlldNcgdv7nn1Sq8g HwB2BHdIAkYce3hEoDQXt/mKlgEGsLpzJcnLKimtPXQQy9TxUaLBe9PInPd+Ohix0XOlY+Uk QFEx50Ki3rSDl2Zt2tnkNYKUCvTJq7jvOlaPd6d/W0tZqpyy7KVay+K4aMobDsodB3dvEAs6 ScCnh03dDAFgIq5nsB11j3KPKdVoPlfucX2c7kGNH+LUMbzqV6beIENfNexkOfxHfw==
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 03 Mar 2025 10:17:20 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 28.02.25 18:34, Anthony PERARD wrote:
On Thu, Feb 27, 2025 at 04:10:25PM +0100, Jürgen Groß wrote:
On 26.02.25 16:55, Anthony PERARD wrote:
On Tue, Feb 25, 2025 at 08:30:33AM +0100, Juergen Gross wrote:
Channels work differently than other device types: their devid should
be -1 initially in order to distinguish them from the primary console
which has the devid of 0.

So when parsing the channel configuration, use
ARRAY_EXTEND_INIT_NODEVID() in order to avoid overwriting the devid
set by libxl_device_channel_init().

Signed-off-by: Juergen Gross <jgross@xxxxxxxx>

This might want a:
      Fixes: 3a6679634766 ("libxl: set channel devid when not provided by 
application")

Before that, the devid set by `xl` was probably ignored. I think before,
the console devid would be taken from libxl__init_console_from_channel()
parametters, so the first devnum would be `0+1`, so never 0.

Do you agree?

I'm not sure I do. The use of ARRAY_EXTEND_INIT() in xl_parse.c predates
commit 3a6679634766, so there is certainly more than one potential Fixes:
candidate.

Of course, this was my first candidate as well, but that's part of the
original introduction of channel to the source code, so it didn't really
make sense to that the feature was commited with devid=0, surely it
would already been an issue at the time. This is why I start looking
in libxl on how devid was used.

So at least for the xl case commit 3a6679634766 isn't relevant, and my patch
is fixing the xl case only.

Last time I check, `xl` is using libxl, so any change to libxl can
impact xl.

Of course, but with xl devid was never -1, so 3a6679634766 shouldn't make
a difference.

Before 3a6679634766, channel#0 would be connected to console#1 because
libxl__init_console_from_channel() was called with dev_num=`channel#+1`,
and $dev_num was used to set console.devid.

After 3a6679634766, we have console.devid=channel.devid=dev_num if
channel.devid is -1, or console.devid=channel.devid.

Without 3a6679634766, having more than one channel with devid=-1 would
result in failing to start due to having more than one channel with the
same devid.

Do you have any prove that more than one channel ever worked?


So the only good candidate is:
Fixes: 3a6679634766 ("libxl: set channel devid when not provided by 
application")

In the end I don't feel strong with this. If you really want, I can add
this Fixes tag.

Also, I'm not sure channels are going to work properly if there's more
than one console, lots of code seems to assume
console.devid=channel.devid+1, and there's probably other issues.

I believe channels are not tested a lot.


Juergen

Attachment: OpenPGP_0xB0DE9DD628BF132F.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.