Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2697699imw; Wed, 6 Jul 2022 10:11:28 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vBN/ArrLEy2ZsyuZYqh1CuGoUuym9ngZms5HrhrLBOSJjuG1xNUSetQZzxIiz/z9tGvjou X-Received: by 2002:a17:90b:4c8c:b0:1ef:bff6:c964 with SMTP id my12-20020a17090b4c8c00b001efbff6c964mr2024023pjb.36.1657127488535; Wed, 06 Jul 2022 10:11:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657127488; cv=none; d=google.com; s=arc-20160816; b=gSRFlmmgHiEftlnaMrAajtFtI0lRH1Gtq7yoHxrEAytcBoLcfJhAXbcBgIaLcbmXYz S9TjEjEeEoB5ezIPKXWc5O/J9Uv8duzBRkj3llRmOfkbMVTBXHDrF4PstczvxI1KuUl3 VkJdHudfewG+sjCo2N+x4UQzPVXbLsRNtfdwULvng+Ghyh3psy4MccdWgoG7UrdTEXBz wsbG+OlOOpXXpjJngMFRV0th+CM1uWQvCuRB0fjhXR2L8Hz0mfCtn5L5yrRlkusVT+m+ hK1rdCc5quyMX3kovnoTz0SxeOSYuzxq+GgCf+ILAwev9ikGNwQZhxkvmqksxZTjq73/ B2Lw== 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:dkim-signature; bh=YuG9Q+oxYEiway3JJ+jBLFvim0S1LMN5Amv/Z4wmYOg=; b=ipKdo9jZTCQ23ua3DfSYQHP5z7ZAB7BTm+KhQHZ/ufrOabbyGCDVvo4j1IsAu+Tvns +ZB28StSVjVe4HQmU9Zucln+4hZZtAaRW/gUljxQhqX8QTppJCHI3HsI6DQqpBvjbQWu ZWloeawjtEYsutdCqjqqE37/4S1kJQL5FWXiPlys2ZeCsPMupFY8qxHokQLFMQCw8Qdn asL0LdzeRQaHmAfPfkADhABBzrXY6ltvO6DJn0+Ygh4COrlE676Fz2+raHpdOQqpuoch i6tm0lkCT3PRlpdmC1GnGdDyG92o8kPxa+K+6QfTlNClR/yVIU5dOvxz8+r7CWsqWrpz XE7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@alien8.de header.s=dkim header.b=EOVKH88U; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t10-20020a17090a2f8a00b001ec99ac7265si27906500pjd.126.2022.07.06.10.11.15; Wed, 06 Jul 2022 10:11:28 -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=@alien8.de header.s=dkim header.b=EOVKH88U; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=alien8.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232445AbiGFRBc (ORCPT + 99 others); Wed, 6 Jul 2022 13:01:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231454AbiGFRBa (ORCPT ); Wed, 6 Jul 2022 13:01:30 -0400 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A18964D1 for ; Wed, 6 Jul 2022 10:01:29 -0700 (PDT) Received: from zn.tnic (p200300ea970ff625329c23fffea6a903.dip0.t-ipconnect.de [IPv6:2003:ea:970f:f625:329c:23ff:fea6:a903]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.skyhub.de (SuperMail on ZX Spectrum 128k) with ESMTPSA id 372DB1EC0453; Wed, 6 Jul 2022 19:01:23 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1657126883; 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:in-reply-to:in-reply-to: references:references; bh=YuG9Q+oxYEiway3JJ+jBLFvim0S1LMN5Amv/Z4wmYOg=; b=EOVKH88UnwbLUGmgyTFs6FasfHgJZWGtuo5qd9U2XujbRMoomm+jklABu0L5mmqRDWIYKS 6sX8bZuCKS/Svvc1Ue3/+A9RQTeqkeFyDI7QVgA9nZl1k5a6QdUys/lsRGfvh+BIBPHXHN AyMRh/70e+IFGqqPfhAFHm5sislbIFo= Date: Wed, 6 Jul 2022 19:01:19 +0200 From: Borislav Petkov To: Jan Beulich Cc: Andrew Lutomirski , "dave.hansen@linux.intel.com" , Peter Zijlstra , lkml , "xen-devel@lists.xenproject.org" Subject: Re: [PATCH] x86/PAT: have pat_enabled() properly reflect state when running on e.g. Xen Message-ID: References: <9385fa60-fa5d-f559-a137-6608408f88b0@suse.com> <016d281b-7e40-f1bd-66ee-c19c3cc56efe@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 On Wed, Jul 06, 2022 at 08:17:41AM +0200, Jan Beulich wrote: > Sure, but that alone won't help. Well, the MTRR code looks at X86_FEATURE_MTRR. If Xen doesn't expose the MTRRs, then that bit should be clear in the CPUID the guest sees. So in that case, you could test X86_FEATURE_XENPV at the end of mtrr_bp_init() and not disable PAT if running as a PV guest. Would that work? > There's a beneficial side effect of running through pat_disable(): > That way pat_init() will bail right away. Without that I'd need to > further special case things there (as under Xen/PV PAT must not be > written, only read) We have wrmsr_safe for that. > Any decent hypervisor will allow overriding CPUID, so in principle > I'd expect any to permit disabling MTRR to leave a guest to use > the (more modern and less cumbersome) PAT alone. So I'm being told that it would be generally beneficial for all kinds of virtualization solutions to be able to support PAT only, without MTRRs so it would be interesting to see how ugly it would become to decouple PAT from MTRRs in Linux... Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette