From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTP id 566815A0082 for ; Fri, 24 Feb 2023 20:33:04 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677267183; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=IsuK04uAqpjFFfC92ftp2NVshMreOx/mancA3l5zelg=; b=JEEVn0OseCn0RozwyBiio93ivbwZZgpFvsDnd8H9xocy3xYQwOCE82EJxOCPmbx3T+EEah jJIFngQGaa5daw1qb/HpKjdjOxIMTckeqHnv9af/s6FE3w4Mv8O1lkF9SgxUaZoMHf4HNs OSfoFpaoz5sbVWl25nqaPu72hxZlVN0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-596-WrVSnSlENIWzf3038wz1yw-1; Fri, 24 Feb 2023 14:33:00 -0500 X-MC-Unique: WrVSnSlENIWzf3038wz1yw-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 03807101A521; Fri, 24 Feb 2023 19:33:00 +0000 (UTC) Received: from maya.cloud.tilaa.com (unknown [10.33.32.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9F812492B12; Fri, 24 Feb 2023 19:32:59 +0000 (UTC) Date: Fri, 24 Feb 2023 20:32:56 +0100 From: Stefano Brivio To: Andrea Bolognani Subject: Re: [PATCH] qrap: Pass PCI device numbers to qemu in base 10, not in base 16 Message-ID: <20230224203256.613a07a1@elisabeth> In-Reply-To: References: <20230221192425.3745394-1-sbrivio@redhat.com> <20230224081416.47b85d01@elisabeth> Organization: Red Hat MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: RHFBETCMHFCUFTTEPVCBIBHFZXAARPE6 X-Message-ID-Hash: RHFBETCMHFCUFTTEPVCBIBHFZXAARPE6 X-MailFrom: sbrivio@redhat.com 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: David Gibson , passt-dev@passt.top, Alona Paz X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Fri, 24 Feb 2023 11:05:00 -0800 Andrea Bolognani wrote: > On Fri, Feb 24, 2023 at 08:14:16AM +0100, Stefano Brivio wrote: > > On Thu, 23 Feb 2023 06:06:17 -0800 Andrea Bolognani wrote: > > > On Thu, Feb 23, 2023 at 09:27:14AM +1100, David Gibson wrote: > > > > On Wed, Feb 22, 2023 at 02:40:32AM -0800, Andrea Bolognani wrote: > > > > > I don't think this is going to work. > > > > > > > > > > The problem is that, while PCI buses are indeed named with increasing > > > > > numbers in integer format (pci.9, pci.10 and so on), PCI slots are > > > > > addressed using hexadecimal format (0x9, 0xa and so on). libvirt uses > > > > > this naming convention because it matches QEMU's. > > > > > > > > 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=10 and addr=0xa are equivalent). > > > > 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. > > > > > > 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. > > > > 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 might > > 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. > > I strongly disagree with this assessment. This patch merely trades > one set of issues for another one. > > In particular, for pc machine types we'd end up producing > bus=pci.0,addr=0x10 for slot 10 instead of bus=pci.0,addr=0xa, > because the addr=0x part is baked into the template. So the QEMU > logic David mentioned above wouldn't kick in at all. > > 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. Oh, okay, sorry, I thought you and David agreed that it actually happens to work. But anyway, nice that it doesn't matter now. :) > > 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). > > 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. Thanks a lot! 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. -- Stefano