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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ACA6B200B96 for ; Wed, 27 Nov 2024 17:22:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732728171; cv=none; b=dELVDA4wheC+srEhAGsjNxlsW3gd9BI/ry0VsVXhxDmJMuzVdCXdwqZXZTtNQbGUsksE528Xyr9jEYF8j/6OoB2MM5fjMOlLunmO5GlcTKhQDNNF7Q/WXhvLYFZpbi8SWp9Rxvkrq5WHQsiHtdlzlcHO/u6Zutwb+RQ+TwwGAm0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732728171; c=relaxed/simple; bh=udRSauQ8v0m45QJa02tpuWABp6MhR6MgqKOiA1qUWyg=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lX+hu8n8FQVA2pmK9X6KJEkaIUhg6bAN4hMvQamPp6OKFefa1OSzZ+3Y30H0TkxlRgqjjdgd0jeOn/jm1Dr/E0mXenjYjoEu1zDUGc6iMX7Bo3Fq4FORgmHq/Ir6wENLT8Y3bg/mxbe5AAuzj78dHPaJ3X1dkRebbEngPjlJ+ak= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=CkC26/F+; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="CkC26/F+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1732728168; 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=W9zax/CHaztlMaSgeA0GgU43P1mgjhVVVedx0D3zKOY=; b=CkC26/F+KE1Qm4TVnxGq1tRbGD66ty8IpqptluLtPT8kbMIDbnr8sphtugpAHmzk3nYZRu MgK5HlFvfyg9RUz2+a5YnOBoAQBozzNkRpq+ByX+SwB1Q1Di131Iuke5Qv0smHbdSnWKDd OYzXiqcTTiEu/snwQFI0NBnTYh88g8Y= Received: from mail-il1-f199.google.com (mail-il1-f199.google.com [209.85.166.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-456-RM4GIlw2MHi_JZlCvq4KxA-1; Wed, 27 Nov 2024 12:22:47 -0500 X-MC-Unique: RM4GIlw2MHi_JZlCvq4KxA-1 X-Mimecast-MFC-AGG-ID: RM4GIlw2MHi_JZlCvq4KxA Received: by mail-il1-f199.google.com with SMTP id e9e14a558f8ab-3a7c836fda9so291315ab.0 for ; Wed, 27 Nov 2024 09:22:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732728166; x=1733332966; 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=W9zax/CHaztlMaSgeA0GgU43P1mgjhVVVedx0D3zKOY=; b=ib01qpg8QFVO+v3SpV8YqUsImOt2m8tl/iAG8rVL5llNm3ORqXpG5Jd0fBInvP6GpP J+tV9SI/cxaL8tSYMObNPFPWwJ6s8sDAOZaOMkIbVNmk5i10qaC8NcDUvCiFiRfeeqhN A4cnzsjDvRSemblJyw6bxZlJZszBfY6B3BBvAQ9DKPirYdDevZe6JxYe2cDTfra7jyTA R3lohZn9QqpzqwsgWUHlrzWYkdsZvhmO+bxeShsp6Qp77WJgxpciif+uv/P8niUeR4t1 eGEc95/NkkjOXrw5hwja8uyA2pOoZEIQJ9TyTjyDOfaTNikibC2HVFNQ6pOAwKpK16/g oYcQ== X-Forwarded-Encrypted: i=1; AJvYcCV4nk6PKoKowKrXvPuADnzrLhT/Wi3oPSomEbk78ezAvI24YQJe3o4QDSkbMR2wjT7J9Sl/toYPzDNgP1s=@vger.kernel.org X-Gm-Message-State: AOJu0Yy9ljT4bd1cjMMjYykhqDWNPdbYLUlpbqMwIjAaIi7TBrBUcaNE l6xLmq5w+J62SM56JmglXLen3/E1BDQ7QPDb3sr6TzC5FHDP46KI9r5U4b+URwqbOoDelTS/HZm k9+GeWspaNmTubXeDNTG2Vh9t/UkjYJrqnCFwHg/whGqtfQyyCGXidgD+PbklFg== X-Gm-Gg: ASbGnctb+HBMXcVA8wa2Gy5DX6+F2bHPQ+XGKCBh7DNkrh9rkP2tuWUUuGaXDxK4W5I ZXfBRjGbeSJdp1Hpab/9O389cojLHDnKQciAUECwCMc069I2HCwmbuybveL5L8iIyquAhuKcmO8 vcfuhMuKhl5m8l/jraWrRzM019WCBzDjDkg4Pyqikunn3GnNpi5eP2/p5AGUnKW5VS+ORuH/n/I k6VzaRWwThPAtfvNEvQWS9aWmaS9RTJBjaKTwE5CXjk0LWuKxu4aA== X-Received: by 2002:a05:6e02:1785:b0:3a7:bd4c:b17e with SMTP id e9e14a558f8ab-3a7c544a689mr11641895ab.0.1732728166282; Wed, 27 Nov 2024 09:22:46 -0800 (PST) X-Google-Smtp-Source: AGHT+IFgahiLZdXLot24IB4E3W1bQXNAY3TqwQBGglHBYwgd/Sn9n6D44soFsrc5jyVRxyY14SiM6Q== X-Received: by 2002:a05:6e02:1785:b0:3a7:bd4c:b17e with SMTP id e9e14a558f8ab-3a7c544a689mr11641795ab.0.1732728165925; Wed, 27 Nov 2024 09:22:45 -0800 (PST) Received: from redhat.com ([38.15.36.11]) by smtp.gmail.com with ESMTPSA id e9e14a558f8ab-3a79acbdf6asm27282405ab.77.2024.11.27.09.22.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2024 09:22:45 -0800 (PST) Date: Wed, 27 Nov 2024 10:22:43 -0700 From: Alex Williamson To: Mitchell Augustin Cc: linux-pci@vger.kernel.org, kvm@vger.kernel.org, Bjorn Helgaas , linux-kernel@vger.kernel.org Subject: Re: drivers/pci: (and/or KVM): Slow PCI initialization during VM boot with passthrough of large BAR Nvidia GPUs on DGX H100 Message-ID: <20241127102243.57cddb78.alex.williamson@redhat.com> In-Reply-To: References: <20241126103427.42d21193.alex.williamson@redhat.com> <20241126154145.638dba46.alex.williamson@redhat.com> <20241126170214.5717003f.alex.williamson@redhat.com> X-Mailer: Claws Mail 4.3.0 (GTK 3.24.43; x86_64-redhat-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Tue, 26 Nov 2024 19:12:35 -0600 Mitchell Augustin wrote: > Thanks for the breakdown! > > > That alone calls __pci_read_base() three separate times, each time > > disabling and re-enabling decode on the bridge. [...] So we're > > really being bitten that we toggle decode-enable/memory enable > > around reading each BAR size > > That makes sense to me. Is this something that could theoretically be > done in a less redundant way, or is there some functional limitation > that would prevent that or make it inadvisable? (I'm still new to pci > subsystem debugging, so apologies if that's a bit vague.) The only requirement is that decode should be disabled while sizing BARs, the fact that we repeat it around each BAR is, I think, just the way the code is structured. It doesn't take into account that toggling the command register bit is not a trivial operation in a virtualized environment. IMO we should push the command register manipulation up a layer so that we only toggle it once per device rather than once per BAR. Thanks, Alex