From mboxrd@z Thu Jan  1 00:00:00 1970
Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3])
	by passt.top (Postfix) with ESMTPS id AA52F5A0082
	for <passt-dev@passt.top>; Sat, 25 Feb 2023 02:55:53 +0100 (CET)
Received: by gandalf.ozlabs.org (Postfix, from userid 1007)
	id 4PNqbm6yq1z4x87; Sat, 25 Feb 2023 12:55:48 +1100 (AEDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
	d=gibson.dropbear.id.au; s=201602; t=1677290148;
	bh=xKcUPiWCU2vhvqtm1f4hOE+ezM5FevGAQOFQOx77cdA=;
	h=Date:From:To:Cc:Subject:References:In-Reply-To:From;
	b=RT1StPkaXgcRwBg2JFj8LrHMD5WRunYd/K5yV4FApoR5XsTCWzXpOszclUn0Eua9N
	 3MvzEiaoRImZzdMgAGNfGBV8T5ZmXB4zEGu9ybKLNnDvNHT1px4klIwq2upHqx27na
	 IbYwpi31Ox85xfasNwWZq8m21ncfeexJ2ibSxmxc=
Date: Sat, 25 Feb 2023 12:44:28 +1100
From: David Gibson <david@gibson.dropbear.id.au>
To: Stefano Brivio <sbrivio@redhat.com>
Subject: Re: [PATCH] qrap: Pass PCI device numbers to qemu in base 10, not in
 base 16
Message-ID: <Y/ln/EUARCKpZtzG@yekko>
References: <20230221192425.3745394-1-sbrivio@redhat.com>
 <CABJz62Op3xZyh9Gbqw9J7b-F7SpY3ziW33B8g4M00BU7z-4C7g@mail.gmail.com>
 <Y/aWwqUN5GX+mbK2@yekko>
 <CABJz62P7odJ+mL23t=pB_8KVeEjMvTUwAHzuqOOWLwNCQKYRrw@mail.gmail.com>
 <20230224081416.47b85d01@elisabeth>
 <CABJz62M5x0B5z5xqdOr=5uGMCrjFjYR6WJJDTbBOa=ajBUs=cA@mail.gmail.com>
 <20230224203256.613a07a1@elisabeth>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature"; boundary="vd/FDe+U/5XpNr7D"
Content-Disposition: inline
In-Reply-To: <20230224203256.613a07a1@elisabeth>
Message-ID-Hash: EFOZXJR75UY5B2CFQ5FWRD6YYAB3QWZ5
X-Message-ID-Hash: EFOZXJR75UY5B2CFQ5FWRD6YYAB3QWZ5
X-MailFrom: dgibson@gandalf.ozlabs.org
X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header
CC: Andrea Bolognani <abologna@redhat.com>, passt-dev@passt.top, Alona Paz <alkaplan@redhat.com>
X-Mailman-Version: 3.3.8
Precedence: list
List-Id: Development discussion and patches for passt <passt-dev.passt.top>
Archived-At: <https://archives.passt.top/passt-dev/Y/ln/EUARCKpZtzG@yekko/>
Archived-At: <https://passt.top/hyperkitty/list/passt-dev@passt.top/message/EFOZXJR75UY5B2CFQ5FWRD6YYAB3QWZ5/>
List-Archive: <https://archives.passt.top/passt-dev/>
List-Archive: <https://passt.top/hyperkitty/list/passt-dev@passt.top/>
List-Help: <mailto:passt-dev-request@passt.top?subject=help>
List-Owner: <mailto:passt-dev-owner@passt.top>
List-Post: <mailto:passt-dev@passt.top>
List-Subscribe: <mailto:passt-dev-join@passt.top>
List-Unsubscribe: <mailto:passt-dev-leave@passt.top>


--vd/FDe+U/5XpNr7D
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Fri, Feb 24, 2023 at 08:32:56PM +0100, Stefano Brivio wrote:
11;rgb:ffff/ffff/ffff> On Fri, 24 Feb 2023 11:05:00 -0800
> Andrea Bolognani <abologna@redhat.com> wrote:
>=20
> > On Fri, Feb 24, 2023 at 08:14:16AM +0100, Stefano Brivio wrote:
> > > On Thu, 23 Feb 2023 06:06:17 -0800 Andrea Bolognani <abologna@redhat.=
com> wrote: =20
> > > > On Thu, Feb 23, 2023 at 09:27:14AM +1100, David Gibson wrote: =20
> > > > > On Wed, Feb 22, 2023 at 02:40:32AM -0800, Andrea Bolognani wrote:=
 =20
> > > > > > I don't think this is going to work.
> > > > > >
> > > > > > The problem is that, while PCI buses are indeed named with incr=
easing
> > > > > > numbers in integer format (pci.9, pci.10 and so on), PCI slots =
are
> > > > > > addressed using hexadecimal format (0x9, 0xa and so on). libvir=
t uses
> > > > > > this naming convention because it matches QEMU's. =20
> > > > >
> > > > > Actually, I think we're ok.  PCI slots are addressed in hex by
> > > > > convention, but AFAICT if you *just* give a slot number, it will
> > > > > accept either decimal or hex (so addr=3D10 and addr=3D0xa are equ=
ivalent).
> > > > > That's *not* true if you use SS.F format to include the function
> > > > > number - then it expects hex only.  But we're not doing that, so =
so
> > > > > always using decimal should be ok here.
> > > > >
> > > > > Source: set_pci_devfn() in the qemu source
> > > > >
> > > > > Obviously that's a pretty fragile hack, but that's 'qrap' for you=
=2E =20
> > > >
> > > > Yeah, even if that happens to work I'd rather not rely on it,
> > > > especially since a proper solution doesn't look like it would be a
> > > > lot of additional effort.
> > > >
> > > > I've managed to reproduce the original issue in the context of
> > > > KubeVirt. I'll hopefully have a patch ready soon. =20
> > >
> > > Andrea, allow me to do this: I would push this patch meanwhile, along
> > > with the changes for the DNS issue you reported, because that one mig=
ht
> > > impact many users, and I think it makes sense to have a fix out soon.
> > >
> > > I start thinking it's also part of the issue Paul reported for Podman
> > > with pasta here:
> > >   https://github.com/containers/podman/issues/17074
> > >
> > > This patch itself can't hurt, and it changes exactly two letters. =20
> >=20
> > I strongly disagree with this assessment. This patch merely trades
> > one set of issues for another one.
> >=20
> > In particular, for pc machine types we'd end up producing
> > bus=3Dpci.0,addr=3D0x10 for slot 10 instead of bus=3Dpci.0,addr=3D0xa,
> > because the addr=3D0x part is baked into the template. So the QEMU
> > logic David mentioned above wouldn't kick in at all.
> >=20
> > More importantly, for q35 machines we'd start producing decimal bus
> > numbers while still parsing the ones present in the original command
> > line as hexadecimal, so things would stop lining up as soon as enough
> > devices are present, meaning that the issue reported by Alona would
> > still exist.
>=20
> Oh, okay, sorry, I thought you and David agreed that it actually
> happens to work. But anyway, nice that it doesn't matter now. :)

Sorry, I missed that '0x' was in the template.  Of course that can be
very easily fixed.

> > > As soon as you have something less qrappy we'll go with that (you don=
't
> > > even need to rebase, I'll revert this one on the tree first). =20
> >=20
> > Patches fixing this issue, as well as a few additional ones, are now
> > on the list. I'll follow up on that thread with some considerations
> > related to testing the changes.
>=20
> Thanks a lot!
>=20
> I didn't push out commits or a release today because I hit a false
> positive with cppcheck 2.10 (cppcheck bisected but still trying to
> grasp the issue), so that will all be for the next week I guess.
>=20

--=20
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

--vd/FDe+U/5XpNr7D
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmP5Z/YACgkQzQJF27ox
2Gff4w/8CqRkkJLipvT/g0HcnMZTABYHoXzDhnAjaTzy5mAX/Z9Ppwr7Azj/D8FP
0alNOCVYs+GhkmwsBZJig/3KpdrIPbXCctUQPpVJ7nLfeKJCqh7JoYmAKU7AIDA+
zkUuQpw1IZn073eurs2HJrAGqg3soieXsDNMO82wtX5hlaLnrHCtu/zu6nUyOSPi
4jdqLnN7Wp7/azf1ztzfYrBSXV0366GLd7T88lpzbt+pc6rPpgVNKsaQVuWoEjkf
dJPFKBYjyVK1wBeSrOz9d7dSRE+r3tv9eAzAfrS2vj/b215oNUYfhq/oOh9Qifyn
ACMqWOogJy6UtIuAyjtllnm/Y6GSTPzpGHgOn/hTtrkLgaIbG531S5kX4AWCRD+b
fhg0OVS4RFk1M1pGsEO1EO5C76PIoXO7WzIU0tMIV4yW574HsrqKvcTX2JQZSGu3
Hez+hrGADHBns7llwY+M26ynSCNI4bR04OXtRDqRAiY35zoAFxXD4WSNzENIEyo+
YMeTvpmL6Iig3hhzAAqq87Evbqtj/DfZVpYqIUgfnozPqCnJVsw/DQWFRdazzrCW
EZj/0gev4Xj8lIGmlxJDIyWh31LqoTliOFEwXSge9EM+Km+Ggg3nfxa5GsSMvuj4
NpC6egaT/MoxYMab194BHHvZ6O98nQEp5UYH1MX+drj7fULQ1Xs=
=edEw
-----END PGP SIGNATURE-----

--vd/FDe+U/5XpNr7D--