Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2275218rwd; Fri, 19 May 2023 03:35:14 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6XDq37RIghbl0pctCFKBPRB1LHdx9aD4g33lCU2+NCsDv4We8U/4I6OiIj/5jePmhK25WJ X-Received: by 2002:a17:902:82c4:b0:1ae:72fc:a625 with SMTP id u4-20020a17090282c400b001ae72fca625mr2263959plz.37.1684492513531; Fri, 19 May 2023 03:35:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684492513; cv=none; d=google.com; s=arc-20160816; b=GJH/4eobq2RukG3tUPkDU/1MtuUbck6nHtJd9sXMlsv5fLf6vbjXM+nqMCxbwKqmqC ZihA8+hJbEAOfiHtQ8lPzo7zQchDs7BI5XARkiBBTgK1IPokV78/FP4F/h/CQPtz1bix wHUsMOYz5dAAOGKjn/2tC5W2bUOPNDbzantxXZ9P4yY4Op/0mEvWHk1FS3rz6RL9PE0L 3jeJHIfMxsqI95t63m7mf8Qt9AUVPoglj9NZUMRZo8geU1DtSkkSEa+b7F0X534u5+Pa LSTmZOeVxMi7l1F7mKlXEhZwo9RarwGDje4W0nHZD6sCl7vJmKXytyaAXqFkRaOCK43m vx8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:feedback-id :dkim-signature:dkim-signature; bh=WmoTlhd7e1kwJpAAsaCCOOQJxMdCzpL/nDPL1E42Cfo=; b=JMNkqsdj5aRTcOtKGrZCfJMM3Ivnt7MMqnFH4bJYT6PGqGHVqvsUi9ZV9dXyfz8i/6 87k44UgygYfMrl4wkN6R+5UiBJauFwvQJX7j6TKDmYD3VRkzFT5iYma659iGYnKebH6O xY/nPUWBMXxXjn53m671m+O0e7572HtSn5Ss2LgmpXRq3ndSK+Mq4jKrwrsEmuK5Ldnn HHDyIWD0UGO2TONP9/R+EPSlLYRAY7FXFbRMS4k6iQjuEMhIDAOJGMfNWLDglZuhQxRp LyO7iT5VgPrjrtN0AABcFH/yuzO26Llp+ehrE1JGLLCUHJrTDZ14nLKDwBxwI6/3+cDF U8Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@invisiblethingslab.com header.s=fm1 header.b=P5i+sNrz; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=xGmbjPzl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l6-20020a170902ec0600b001a9b4bda723si3073624pld.421.2023.05.19.03.34.47; Fri, 19 May 2023 03:35:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@invisiblethingslab.com header.s=fm1 header.b=P5i+sNrz; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=xGmbjPzl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231720AbjESKKi (ORCPT + 99 others); Fri, 19 May 2023 06:10:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41402 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230473AbjESKKg (ORCPT ); Fri, 19 May 2023 06:10:36 -0400 Received: from out1-smtp.messagingengine.com (out1-smtp.messagingengine.com [66.111.4.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FF8F9C for ; Fri, 19 May 2023 03:10:35 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 590545C014B; Fri, 19 May 2023 06:10:32 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Fri, 19 May 2023 06:10:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= invisiblethingslab.com; h=cc:cc:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm1; t= 1684491032; x=1684577432; bh=WmoTlhd7e1kwJpAAsaCCOOQJxMdCzpL/nDP L1E42Cfo=; b=P5i+sNrzGgkybQ2llHpdSW2AKLSaYvzjLV/X1tKoCOnMEuquyum Xz7L7fUs5n+bcz3EquSOz/LyYzo4+bnInf6pePRv8KXFTe1Ri70wn0/aQTymk6Nj 3cOgoNnjULfVW8UqeTZdOxRVQ+EBZ+LWRXrUhP2M9QLZF0gH6sQkNPc9qKZCOrO9 9MfZ9MN3Y9m8U5zroM3O8KCYAEdroMxEt0djE4C7v+kuG5NSqqLCvp420255lmj3 Zfhv2QVb/G0g/MmOCnqA0OBNGNTtKmfHSBfBvNe+eSi5vldVRS0rB6sPFGLPp1+q imYfiENJ01Bse+gNazzWEmT6kALsLF8G68A== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; t=1684491032; x=1684577432; bh=WmoTlhd7e1kwJ pAAsaCCOOQJxMdCzpL/nDPL1E42Cfo=; b=xGmbjPzlgjhHajV61PT0fxHOkTPA9 P/BKddYJeZL8r3HwmUtZQoGkTKDM3sMX2G2E47LEKMHpnsftch7DUZCK3BGFhY94 qp7VHIhqnZbVw9bKSeYk7xj1S+ywBdu1R3Z+/eMTB4h0v5/lNdk7d0UjJ6+USLn/ P/hvq8ohUkOE9QafrdILUftyhnmjgg631lGCldrTurUHMVTM73uZKI3dDsT/NJWJ X/UjqL6iaIaAhkO2lv6CnDY+vYB14qlO0xDRW15Eu4p2VpQ+NsZcRo5gdaBSL5/u UwkL3yHLMhGBwUUudXDfwgnrAIf6s8EPADQJkSMIokbsiTEV/s8yHvbEw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrfeeihedgvdeiucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggujgesghdtreertddtjeenucfhrhhomhepofgrrhgv khcuofgrrhgtiiihkhhofihskhhiqdfikphrvggtkhhiuceomhgrrhhmrghrvghksehinh hvihhsihgslhgvthhhihhnghhslhgrsgdrtghomheqnecuggftrfgrthhtvghrnhepgfdu leetfeevhfefheeiteeliefhjefhleduveetteekveettddvgeeuteefjedunecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhgrrhhmrghrvghk sehinhhvihhsihgslhgvthhhihhnghhslhgrsgdrtghomh X-ME-Proxy: Feedback-ID: i1568416f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 19 May 2023 06:10:29 -0400 (EDT) Date: Fri, 19 May 2023 12:10:26 +0200 From: Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= To: Christoph Hellwig Cc: Juergen Gross , Stefano Stabellini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Ben Skeggs , Karol Herbst , Lyude Paul , xen-devel@lists.xenproject.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org Subject: Re: [PATCH 2/4] x86: always initialize xen-swiotlb when xen-pcifront is enabling Message-ID: References: <20230518134253.909623-1-hch@lst.de> <20230518134253.909623-3-hch@lst.de> <20230519040405.GA10818@lst.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="A3eIvvbx7EttM1KL" Content-Disposition: inline In-Reply-To: <20230519040405.GA10818@lst.de> X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham 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 --A3eIvvbx7EttM1KL Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Date: Fri, 19 May 2023 12:10:26 +0200 From: Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= To: Christoph Hellwig Cc: Juergen Gross , Stefano Stabellini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Ben Skeggs , Karol Herbst , Lyude Paul , xen-devel@lists.xenproject.org, iommu@lists.linux.dev, linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org Subject: Re: [PATCH 2/4] x86: always initialize xen-swiotlb when xen-pcifront is enabling On Fri, May 19, 2023 at 06:04:05AM +0200, Christoph Hellwig wrote: > On Thu, May 18, 2023 at 08:18:39PM +0200, Marek Marczykowski-G=C3=B3recki= wrote: > > On Thu, May 18, 2023 at 03:42:51PM +0200, Christoph Hellwig wrote: > > > Remove the dangerous late initialization of xen-swiotlb in > > > pci_xen_swiotlb_init_late and instead just always initialize > > > xen-swiotlb in the boot code if CONFIG_XEN_PCIDEV_FRONTEND is enabled. > > >=20 > > > Signed-off-by: Christoph Hellwig > >=20 > > Doesn't it mean all the PV guests will basically waste 64MB of RAM > > by default each if they don't really have PCI devices? >=20 > If CONFIG_XEN_PCIDEV_FRONTEND is enabled, and the kernel's isn't booted > with swiotlb=3Dnoforce, yes. That's "a bit" unfortunate, since that might be significant part of the VM memory, or if you have a lot of VMs, a significant part of the host memory - it quickly adds up. While I would say PCI passthrough is not very common for PV guests, can the decision about xen-swiotlb be delayed until you can enumerate xenstore to check if there are any PCI devices connected (and not allocate xen-swiotlb by default if there are none)? This would still not cover the hotplug case (in which case, you'd need to force it with a cmdline), but at least you wouldn't loose much memory just because one of your VMs may use PCI passthrough (so, you have it enabled in your kernel). Please remember that guest kernel is not always under full control of the host admin, so making guests loose 64MB of RAM always, in default setup isn't good for customers of such VMs... --=20 Best Regards, Marek Marczykowski-G=C3=B3recki Invisible Things Lab --A3eIvvbx7EttM1KL Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEhrpukzGPukRmQqkK24/THMrX1ywFAmRnSxEACgkQ24/THMrX 1yxoZQgAigYwLANKEDjGQFkztgAogWxy1LFDTtNJ3E+BQRNBEzsMU2jP0ND6oIWA fuzuDMHRtd7zAop8RQSHwJ+x9OTpPlBR1a7tSxaszuF9tm+l1lWN/6M+fFKNNG+C C8hCEe5NjlcrGsCOzfsPrU2/141dN/1DayOWQ6DPpBawF7PBOZrhqdEKVV+SfVEL D7HM1k8hZj8Nxn39zU0AztoC4HpnhA/ovojpuL7HhyKrs/PbUFgQeJJhYAWDxsNI 1CGjRlyzNFMFBtmC1r7foXOX8AKpcOGeGLcnw5aoMCBnAlZi7rUE/WY+fHGud1tk iPlvgAJ6SgmEF/kRu7VrzljzR8eZZA== =fKf1 -----END PGP SIGNATURE----- --A3eIvvbx7EttM1KL--