From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 46389C63797 for ; Tue, 17 Jan 2023 11:04:40 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pHjlV-0002LW-TU; Tue, 17 Jan 2023 06:04:29 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pHjlQ-0002IG-Pi for qemu-devel@nongnu.org; Tue, 17 Jan 2023 06:04:26 -0500 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pHjlN-0000i3-MJ for qemu-devel@nongnu.org; Tue, 17 Jan 2023 06:04:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1673953461; 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=eyVjNXxDkmKeLwTrHfr3getUGen09SQggMhsus/FQIc=; b=eKB3UkXrIH4+GO/oTPAkLe3M+hQjPE/i9cuqvBRYsWBZ358ajThSfNUfdAD8ODG2PydlTL cnAciQD8HU3TJt3BSNcX+5WouFxBUNqg8Db2BuVjyL/bbdukxwtJoyanUvI7pzW958c7KZ IFTYpGgd8WODN5AV66tDE4PRCZkQMu8= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-518-rgfVh2-KORSKJtJvZd6yag-1; Tue, 17 Jan 2023 06:04:19 -0500 X-MC-Unique: rgfVh2-KORSKJtJvZd6yag-1 Received: by mail-ed1-f72.google.com with SMTP id v8-20020a056402348800b0049e1913bd43so3434664edc.20 for ; Tue, 17 Jan 2023 03:04:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eyVjNXxDkmKeLwTrHfr3getUGen09SQggMhsus/FQIc=; b=3roP95kqugZTsZxDVR76HKwGuFup4QIYBSP/JYLqkIai7AX4nuMFKEj7aeDPTJx6X9 /rtxj3/3IoJ3Uq3B7b2n90lBewWTvVYf6NCvLQHCcMxNzSb/ZY8K6D5fDGNV5M7BAum9 INdYtth7YyM9zFTCJAsBMnKzxRgnoMHwoiqVWINyEBZXZTqkyVeG9MNN3isuNd4q24CK Tt1HkpGPQ2fkFt1Uy3H3JsipuwHpHLRaCOm+dXV6EGphkZsUi7+ZAF+D8glFt7uzPkH2 A968Ew0ibcdjTFk2+ml/YTARAvZjTbQxw+/LfeA3NZAF/wviE3UYh403wi+y076ixtJX 6I+g== X-Gm-Message-State: AFqh2kogcdITq6BkOIhh711Am61oNvysTRKDZTujsd6P+TFxUPMfadnv 62Szb5i41upRT1FFFuckPTD68+FQK61+BlSkC3YY21b/ugIDhfKg7RupVYCGSDhhu7dtbntLGVm qivpVPtw7WrW7f3U= X-Received: by 2002:a17:907:ca85:b0:7c1:1e5a:ed10 with SMTP id ul5-20020a170907ca8500b007c11e5aed10mr2469153ejc.8.1673953458726; Tue, 17 Jan 2023 03:04:18 -0800 (PST) X-Google-Smtp-Source: AMrXdXuMOCZZraUw4zh7iQC3j12bFprGagl0VcCEBpc0ktoOk5ixu3QwIXdb8aSqNQkqCcaYDyEk9A== X-Received: by 2002:a17:907:ca85:b0:7c1:1e5a:ed10 with SMTP id ul5-20020a170907ca8500b007c11e5aed10mr2469119ejc.8.1673953458471; Tue, 17 Jan 2023 03:04:18 -0800 (PST) Received: from imammedo.users.ipa.redhat.com (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id kz11-20020a17090777cb00b007aece68483csm13080334ejc.193.2023.01.17.03.04.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Jan 2023 03:04:17 -0800 (PST) Date: Tue, 17 Jan 2023 12:04:16 +0100 From: Igor Mammedov To: Chuck Zmudzinski Cc: "Michael S. Tsirkin" , Bernhard Beschow , qemu-devel@nongnu.org, Stefano Stabellini , Paul Durrant , Paolo Bonzini , Richard Henderson , Eduardo Habkost , Marcel Apfelbaum , xen-devel@lists.xenproject.org, Philippe =?UTF-8?B?TWF0aGlldS1EYXVkw6k=?= , Anthony Perard , Thomas Huth , Eric Auger , Alex Williamson , Peter Xu Subject: Re: [PATCH v8] xen/pt: reserve PCI slot 2 for Intel igd-passthru Message-ID: <20230117120416.0aa041d6@imammedo.users.ipa.redhat.com> In-Reply-To: References: <20230110030331-mutt-send-email-mst@kernel.org> <9f63e7a6-e434-64b4-f082-7f5a0ab8d5bf@aol.com> <7208A064-2A25-4DBB-BF19-6797E96AB00C@gmail.com> <20230112180314-mutt-send-email-mst@kernel.org> <128d8ee2-8ee9-0a76-10de-af4c1b364179@aol.com> <20230113103310.3da703ab@imammedo.users.ipa.redhat.com> <88af50cb-4ebd-7995-70cf-f23ac33c5e45@aol.com> <20230116163342.467039a0@imammedo.users.ipa.redhat.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.36; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=170.10.133.124; envelope-from=imammedo@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org On Mon, 16 Jan 2023 13:00:53 -0500 Chuck Zmudzinski wrote: > On 1/16/23 10:33, Igor Mammedov wrote: > > On Fri, 13 Jan 2023 16:31:26 -0500 > > Chuck Zmudzinski wrote: > > =20 > >> On 1/13/23 4:33=E2=80=AFAM, Igor Mammedov wrote: =20 > >> > On Thu, 12 Jan 2023 23:14:26 -0500 > >> > Chuck Zmudzinski wrote: > >> > =20 > >> >> On 1/12/23 6:03=E2=80=AFPM, Michael S. Tsirkin wrote: =20 > >> >> > On Thu, Jan 12, 2023 at 10:55:25PM +0000, Bernhard Beschow wrote:= =20 > >> >> >> I think the change Michael suggests is very minimalistic: Move t= he if > >> >> >> condition around xen_igd_reserve_slot() into the function itself= and > >> >> >> always call it there unconditionally -- basically turning three = lines > >> >> >> into one. Since xen_igd_reserve_slot() seems very problem specif= ic, > >> >> >> Michael further suggests to rename it to something more general.= All > >> >> >> in all no big changes required. =20 > >> >> >=20 > >> >> > yes, exactly. > >> >> > =20 > >> >>=20 > >> >> OK, got it. I can do that along with the other suggestions. =20 > >> >=20 > >> > have you considered instead of reservation, putting a slot check in = device model > >> > and if it's intel igd being passed through, fail at realize time if= it can't take > >> > required slot (with a error directing user to fix command line)? = =20 > >>=20 > >> Yes, but the core pci code currently already fails at realize time > >> with a useful error message if the user tries to use slot 2 for the > >> igd, because of the xen platform device which has slot 2. The user > >> can fix this without patching qemu, but having the user fix it on > >> the command line is not the best way to solve the problem, primarily > >> because the user would need to hotplug the xen platform device via a > >> command line option instead of having the xen platform device added by > >> pc_xen_hvm_init functions almost immediately after creating the pci > >> bus, and that delay in adding the xen platform device degrades > >> startup performance of the guest. > >> =20 > >> > That could be less complicated than dealing with slot reservations a= t the cost of > >> > being less convenient. =20 > >>=20 > >> And also a cost of reduced startup performance =20 > >=20 > > Could you clarify how it affects performance (and how much). > > (as I see, setup done at board_init time is roughly the same > > as with '-device foo' CLI options, modulo time needed to parse > > options which should be negligible. and both ways are done before > > guest runs) =20 >=20 > I preface my answer by saying there is a v9, but you don't > need to look at that. I will answer all your questions here. >=20 > I am going by what I observe on the main HDMI display with the > different approaches. With the approach of not patching Qemu > to fix this, which requires adding the Xen platform device a > little later, the length of time it takes to fully load the > guest is increased. I also noticed with Linux guests that use > the grub bootoader, the grub vga driver cannot display the > grub boot menu at the native resolution of the display, which > in the tested case is 1920x1080, when the Xen platform device > is added via a command line option instead of by the > pc_xen_hvm_init_pci fucntion in pc_piix.c, but with this patch > to Qemu, the grub menu is displayed at the full, 1920x1080 > native resolution of the display. Once the guest fully loads, > there is no noticeable difference in performance. It is mainly > a degradation in startup performance, not performance once > the guest OS is fully loaded. Looking at igd-assign.txt, it recommends to add IGD using '-device' CLI option, and actually drop at least graphics defaults explicitly. So it is expected to work fine even when IGD is constructed with '-device'. Could you provide full CLI current xen starts QEMU with and then a CLI you used (with explicit -device for IGD) that leads to reduced performance? CCing vfio folks who might have an idea what could be wrong based on vfio experience.