Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp4456045ioa; Wed, 27 Apr 2022 04:23:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwczaGhVBfR8AjLAcBPKxonl17Uuu/GGRA2qIFLAbKx5gUtd4EPgjuQm1vAPHmG9vr3wlzI X-Received: by 2002:a17:90b:350e:b0:1d2:b6e2:1000 with SMTP id ls14-20020a17090b350e00b001d2b6e21000mr32918417pjb.199.1651058619439; Wed, 27 Apr 2022 04:23:39 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1651058619; cv=pass; d=google.com; s=arc-20160816; b=WXAo73UIpK4l6Wc1d5x4LP7nck9oHnTQAM+TTFBYMxjcWy6WJDPUBgTrnmzPJN3G+1 jWjj6110wf5CSigcWKF0RMs/HT3J73kvsSOPH3u91eDIWmJ3r1exfAS5RM2tuG+nu7aB aXaXMk0zDAAXZmQSBrMX7sw1pi2CCelTo0/2KvliCy9GnulNBJ3vnCEJkcxbeuqLmAG3 W74Siee+h3Srz3ALxhLEuNht0NcKsodMiSqzcUceGFXkD8dCPkKASgYHERClmqTks4i0 cBl0hAk0OqWjG1dGarcPflPrqZqRG3jqedo7XBicKuPOFoCePXuTozy+Kw0dW+V/IAXn cxOg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :msip_labels:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=s1hD7zUJjy0apFTR5J/F3dQGCv72r5cQZIUyf9Zb/SI=; b=nHxqPo2OAt5x7P/4Asah9Q8Q2NBDltEpm1w//YbHPwrum/IsWlgPNnsuxwX/WoRuDa tjYeDpfPxp/QgISBygTVJ2YdM7kszmf7O7ceodk+P1cQOCUlj1QaEOabdWrhQZ4LJSTF okTkjjslCTNd+vswGX7+RR6zXJRJnurq/F8FM829jbXwOGJOSlTYi6KglNuPkW/UXpOC o2FjCLBpRI2hEgynRfU6ivC1L1Vhp0wpwcmA+efPsI8ynFM4RJsSxq+KUUZR7EChfHov mBHNynDz9663z9F2jforeOTWPpreLs0gaeHs9MnF/Jzi2EZ1t4yXwxwvaryielzuXroJ W70A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=ZUaDokJv; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id h2-20020a170902f54200b0015828270c4csi1610120plf.193.2022.04.27.04.23.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 04:23:39 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=ZUaDokJv; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A376947A32E; Wed, 27 Apr 2022 03:17:31 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349070AbiDZSfL (ORCPT + 99 others); Tue, 26 Apr 2022 14:35:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1351543AbiDZSfJ (ORCPT ); Tue, 26 Apr 2022 14:35:09 -0400 Received: from na01-obe.outbound.protection.outlook.com (mail-cusazon11020026.outbound.protection.outlook.com [52.101.61.26]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CFF72982C; Tue, 26 Apr 2022 11:32:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jqIH1tqRDe/qhwnyHCrIi6CcVaGa9SSY5vqdy7x49tLbdzw/YFZozULl6s5BHiWi7TRo0k+HeZBsetQT4OhI2vmuel+2eaQYrc4cUdYAdN0mtgNYt6LtNYqzC4b2tigicj2VM+1ggJHxUwQ0TQ1DFn0zG6I48OJW2r2grcNZlAYk0/tnrSM1gye5Tz6eplFvMz2KRSvXrq8jChtkL+V7IRqH6vvrichRWnXmQaNm1MSzZp9ZFmGwN6yO+O/bBIrSKTcOv5UKGjlUANyjwL8N6p4TX9+T4CbUzvER0Sv8PVLPgeyhnNZCPQAWnx351KBgFkUp6exTL8CWgIlYXybigg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=s1hD7zUJjy0apFTR5J/F3dQGCv72r5cQZIUyf9Zb/SI=; b=elcoNnivYgNe6UJxmNJ1IJyzUZrZceJj+fvzS77SoHFGpu1r7IP/A9Ao8J7bS2ljQn01EBh33k+8935WJUhrOjaNILz0BvPwrh73kuzP83Lc+D7TWSXtzSBwYCyK5B721l2XBS5TqkwD6uHEkmIbz+ec9ZrTzO6dyQXVafRVAFuzpyB+W3DrJlUiDUh23BWGGFkkjSDL0lcdKdQtfj0LtPddk0hJXg6+8O+R7mS0Hiqf/frAOdO74jXULdyFf2WGn78I7t2tZ6jKJAiXVxqPR6if6jaxX6GiAn2B4nSDNrRRwvRjaQT0vCOKwZZvHASWgGvbYdWgVuqS184xkbZozw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=s1hD7zUJjy0apFTR5J/F3dQGCv72r5cQZIUyf9Zb/SI=; b=ZUaDokJvQMOB7WSa1mM/3p4fcKxBvWFBDvCkDHPGYd7ak4H0jbL8ToWL3IQfJQtpEWI9LlF80aBkUnUFNcZzgDLGkQRVupoWLdS7rOGAk7GiydoSZN2EuzlKuCYb9S+l9EtGBXnN+74zVSbOTvDE+jE3p/RM8VY9wthklPwc9lo= Received: from BYAPR21MB1270.namprd21.prod.outlook.com (2603:10b6:a03:105::15) by CY4PR21MB1272.namprd21.prod.outlook.com (2603:10b6:910:7::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5227.4; Tue, 26 Apr 2022 18:31:56 +0000 Received: from BYAPR21MB1270.namprd21.prod.outlook.com ([fe80::2823:3bd7:8a28:4203]) by BYAPR21MB1270.namprd21.prod.outlook.com ([fe80::2823:3bd7:8a28:4203%7]) with mapi id 15.20.5227.004; Tue, 26 Apr 2022 18:31:56 +0000 From: Dexuan Cui To: Lorenzo Pieralisi CC: Jake Oshins , Bjorn Helgaas , "bhelgaas@google.com" , Alex Williamson , "wei.liu@kernel.org" , KY Srinivasan , Haiyang Zhang , Stephen Hemminger , "linux-hyperv@vger.kernel.org" , "linux-pci@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Michael Kelley (LINUX)" , "robh@kernel.org" , "kw@linux.com" , "kvm@vger.kernel.org" Subject: RE: [PATCH] PCI: hv: Do not set PCI_COMMAND_MEMORY to reduce VM boot time Thread-Topic: [PATCH] PCI: hv: Do not set PCI_COMMAND_MEMORY to reduce VM boot time Thread-Index: AdhVrRvIeWjuo4jbQkC6t/9QZsLcgwD39GUAAANHMGA= Date: Tue, 26 Apr 2022 18:31:56 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=4e64cf5a-7ee8-4ca3-9e7a-b567d41fc5e7;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2022-04-26T18:18:33Z;MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 8102f0fb-0f66-455a-8a1e-08da27b30b35 x-ms-traffictypediagnostic: CY4PR21MB1272:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: VBP/WDJf7+aLFrN6sQaQD1SDxx89DUSkUC7mS0TnJBDHJIdj4x0UwBtwC823JzdJ8QxOgNCT1ye8t7G/ZzQPjAxCQMxZs5vuEO/TNL/6ADNtiC3wTLRoKigMUJqc2+qhAP5ZQvcF7EmactOV/+pYEBqHcxafrX3ttLLfqCGb2eH0Ugl3AkDdXPQMt1Lnt0ykPO/AUyakpnmAqMEeZ3kjDx5c0Py9w9NMh2QCQCdrP4woX5ytN0dwMAR7ApGLPIyexGy5a/kBsXQqhqgzbyokzi9csSlOtC9dTQ0S4wEqlavj07iM/rrlHwD94ZL55br3DOMV5XONzMh1D/QN6yWAw3teus8w48Dk7wiQiydSVuTyAEDWHGcFeQ1YaYR8CLRRvilQecVjFWzMJYWyMPWYbljyQcTDr0Hw5/0/aZU/1AYu2crM5R4xJYscpNcDDbfH/WeZFIbFo32JMGdzGOK8eR2jArXySNlmf6c6hzpMLeRUF9Ln/7jnQCgaGuUfCimzL1L/2ewzYq0bGsC6/2GcwxZ55PI9Hol0EAdsPjk8fMovXhHgC/ShiTgstyI8NEsbgCjwYKHzg1Tns+xBN64CpTacdxc4jGKD2+jNsEyJQvNuq531VmoGqDAOpOR3aUGxjOmIkWGoGbxVUM8G43F/n1z2pCgmNZEom8ITFi9D2Zk73Vex85mgjHcTqmLY3pbRFI/AsM6xQe/uInUxd2BZhhE/fItTzUspqdrp0NLVmzOT4DCUeTy9OKT/FZjqVnbS x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR21MB1270.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(451199009)(71200400001)(82950400001)(7696005)(55016003)(8676002)(66476007)(66446008)(76116006)(66946007)(4326008)(8990500004)(38100700002)(38070700005)(26005)(2906002)(9686003)(6506007)(33656002)(64756008)(66556008)(122000001)(8936002)(52536014)(7416002)(82960400001)(508600001)(10290500003)(5660300002)(6916009)(83380400001)(186003)(86362001)(316002)(54906003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?Lju1jlDijh6YHudx6uWGvoEwu5EEd53008jmvSoWEn9rGTDBKDCRxlCd5/g/?= =?us-ascii?Q?D03p95GX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6MFwIBMQFT1+U1gETHCfG6U?= =?us-ascii?Q?NOxQA30VhkirmuSvfRi/h6KJlPHFAQUq+4sak0AMnm6Uyuzz8WLSP3oVIup+?= =?us-ascii?Q?CEnIOsJQF4OzodrzqMkQ7CY48wocjOb3znMFUfGPyyrM/NLNXLB06LTPhbTA?= =?us-ascii?Q?ZMoQHzJFZKdDfCsVuYSNZvqn8EvYp2uBEtnzWkhu/xcTBFdzDLZXFgCGayJb?= =?us-ascii?Q?pwyOafmdo6jeygYnwTQg/wzRexiKVYsIzMl4Q9EnNtMItlngcq6pk2ldZLXb?= =?us-ascii?Q?Go78JFUQnrJUVDLCqqdIliAjfKHKet4m9cFPiozrKhAKAcsuxruQijoV4jxW?= =?us-ascii?Q?YhJ/dhvADiPkyJMzGR46rcSbsipBFCZkH4LJCx4uk+AIdh6gQy+zCNe9FxkG?= =?us-ascii?Q?wgOTpDGm2ppwfTe7IYjPH87IdK2GPYiG2KLnYmQJPRs3+pRlwOFIB/sS108X?= =?us-ascii?Q?EQjYoBnXr8eTMsCwM53IuJg/2VKnvM73zYq91VLuq0MB4/o+GlXtq5XGYzzz?= =?us-ascii?Q?fdp6lkFI4JH8qGhdNWFB6rdVXquO0/M6UZD+JB22DtG/0DtBpx7mwdnxvS+x?= =?us-ascii?Q?h5a3IvyLuxM8o9bdUxK1entgjCXu9Nxfc5LDXI6vHC7iywg1jt9ZdREz5DPG?= =?us-ascii?Q?Zzxi0cshHvJdLnqH/DVvVUSnrUMWrj2qfTcL9qmggnCrwniXlCQkyoIiIWWr?= =?us-ascii?Q?YGZPf1M/8ek/Z5fTeIj6B/2MFqqy4r+waj3IYbm61nXaUBjittFfYRVnFoM4?= =?us-ascii?Q?B2XXyiiXVo8gGNivauw+CVaeFqMl8ci4sRjYWP5/3qsbRwlOmU6atrj+BH8S?= =?us-ascii?Q?D8OtrN21nA=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BYAPR21MB1270.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8102f0fb-0f66-455a-8a1e-08da27b30b35 X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Apr 2022 18:31:56.5983 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: 0nYqXaTaUg1qHUXfgEt2fkloAixwz8bNC6ks3oH+OVgFdPTFFBjrq1rd35fxT1T3cxFxbGS+MoEsqG7iyd1Q6A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB1272 X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > From: Lorenzo Pieralisi > Sent: Tuesday, April 26, 2022 9:45 AM > > ... > > Sorry I don't quite follow. pci-hyperv allocates MMIO for the bridge > > window in hv_pci_allocate_bridge_windows() and registers the MMIO > > ranges to the core PCI driver via pci_add_resource(), and later the > > core PCI driver probes the bus/device(s), validates the BAR sizes and > > the pre-initialized BAR values, and uses the BAR configuration. IMO > > the whole process doesn't require the bit PCI_COMMAND_MEMORY to be > > pre-set, and there should be no issue to delay setting the bit to a > > PCI device device's .probe() -> pci_enable_device(). >=20 > IIUC you want to bootstrap devices with PCI_COMMAND_MEMORY clear > (otherwise PCI core would toggle it on and off for eg BAR sizing). >=20 > Is that correct ? Yes, that's the exact purpose of this patch. Do you see any potential architectural issue with the patch?=20 From my reading of the core PCI code, it looks like this should be safe. Jake has some concerns that I don't quite follow.=20 @Jake, could you please explain the concerns with more details? > If I read PCI core correctly PCI_COMMAND_MEMORY is obviously cleared > only if it is set in the first place and that's what your patch is > changing, namely you boostrap your devices with PCI_COMMAND_MEMORY > clear so that PCI core does not touch it. Yes, this is what exactly the patch is doing. Thanks, -- Dexuan