Received: by 10.192.165.148 with SMTP id m20csp5396411imm; Wed, 9 May 2018 04:30:53 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrDWjaeEKghQYZxwKI6sNui5ghyg3C1Nul1oAPNbs5tutWZ69gYQ2+CNKY1ogb257K/zxUN X-Received: by 10.98.97.5 with SMTP id v5mr2765353pfb.197.1525865453371; Wed, 09 May 2018 04:30:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525865453; cv=none; d=google.com; s=arc-20160816; b=W6REdZlCVtp1UiCavMDxxd88+j7LyJHom4iT5JmhGiF1G30eFei0vQAZZ5srGzY7Yg Q6UxmhcF1HpukVYqgFkATYDjajzhSTJet1+pDmnF0fRrhVlsgDajMicubyLL5GkCc861 T9gVbDkhK+WDOT2EfUyXAzrAm4ysUR0eef/Gc9twM1XtXtWk3sfaS3omK50ZDgbjmgMv lAYlsfYI9vu/43+vq3MQxx1XxSYgMojLd4IkPA4Frjgp8gO20YuAiU0s7BgGdNs1OR8Z w6ItyDqXmPqealRcFewhuPjwcdU6siLidkpCA6/rpNI4mcxY52RlOtZ+07Ur4OodS5sT pWgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=jOKe1r5K4hABLCa1BN2A1o6fxKavKfsjGZauXvU7IBA=; b=FaI3rvFufzoFQ/kueuWR7eYqv8k8PbKawJpNl0HaQcqbWpAP4JJXqwOaOdDPE/r2dl oRGlVPZ5f48pfWTa5MaHKBv1H0yf8dj9LoHG8XnIJanzQVxidaMQ94try+1wuscLSCW5 TMboqIAk2J85mfuskKOGjLggwMymIeqmO71DZKLgHzgq7EFGRMs6wybrIPjX70tLCf6x zX+sXvlouiegP/IAMtWUVzhee4WVm3wE+g3mtO9kNU9AzGGNNPm9I95h+I15kCY6CcwN m3XlW600vjWJr4RIActqoM6XZGe1n5fdyEXs/nw5Eg6QwE5OfD1yJZF8oRGLQf+D5304 29mg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v129-v6si21471896pgb.179.2018.05.09.04.30.38; Wed, 09 May 2018 04:30:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933887AbeEILaY (ORCPT + 99 others); Wed, 9 May 2018 07:30:24 -0400 Received: from smtp.ctxuk.citrix.com ([185.25.65.24]:48886 "EHLO SMTP.EU.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755965AbeEILaX (ORCPT ); Wed, 9 May 2018 07:30:23 -0400 X-IronPort-AV: E=Sophos;i="5.49,381,1520899200"; d="scan'208";a="72823579" Date: Wed, 9 May 2018 12:30:16 +0100 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: Andrew Cooper CC: , Juergen Gross , , Boris Ostrovsky Subject: Re: [Xen-devel] [PATCH v2 1/3] xen/pvh: enable and set default MTRR type Message-ID: <20180509113016.tavac64ba5fu3tob@MacBook-Pro-de-Roger.local> References: <20180509102129.14832-1-roger.pau@citrix.com> <20180509102129.14832-2-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20180323 X-ClientProxiedBy: AMSPEX02CAS02.citrite.net (10.69.22.113) To AMSPEX02CL02.citrite.net (10.69.22.126) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 09, 2018 at 11:56:40AM +0100, Andrew Cooper wrote: > On 09/05/18 11:21, Roger Pau Monne wrote: > > On PVH MTRR is not initialized by the firmware (because there's no > > firmware), so the kernel is started with MTRR disabled which means all > > memory accesses are UC. > > > > So far there have been no issues (ie: slowdowns) caused by this > > because PVH only supported DomU mode without passed-through devices, > > so Xen was using WB as the default memory type instead of UC. > > > > Fix this by enabling MTRR and setting the default type to WB. Linux > > will use PAT to set the actual memory cache attributes. > > > > Signed-off-by: Boris Ostrovsky > > Signed-off-by: Roger Pau Monn? > > I'd argue that this is a bug in PVH starting state. Do you mean that MTRR should be setup before starting the guest? > Do you know what mechanism is used to bodge things to WB in the first > place? If you mean when passthorugh is not used (ie: no IOMMU), then it's at epte_get_entry_emt, grep for need_iommu(d) (line ~801). > I'm not sure that setting the default MTRR type is going to be a > clever idea in hindsight when we come to doing PCI Passthrough support. Setting the default type to WB is also set by hvmloader, it's just that hvmloader also sets some of the fixed and variable ranges to UC in order to cover the iomem areas. The expectations when doing pci-passthrough is that the guest will always use paging and PAT in order to set the appropriate cache attributes, or else the guest itself will have to program the UC MTRR ranges, I admit that's not very nice however. What about enabling the default MTRR type and setting it to WB in the toolstack for PVH? IMO doing it Xen itself would be wrong. Thanks, Roger.