Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8AE47C05027 for ; Mon, 6 Feb 2023 09:43:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229866AbjBFJnS (ORCPT ); Mon, 6 Feb 2023 04:43:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42146 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229573AbjBFJnP (ORCPT ); Mon, 6 Feb 2023 04:43:15 -0500 Received: from mail.skyhub.de (mail.skyhub.de [IPv6:2a01:4f8:190:11c2::b:1457]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F05914492 for ; Mon, 6 Feb 2023 01:43:12 -0800 (PST) Received: from zn.tnic (p5de8e9fe.dip0.t-ipconnect.de [93.232.233.254]) (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 61CA01EC02DD; Mon, 6 Feb 2023 10:43:10 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alien8.de; s=dkim; t=1675676590; 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=7L+NbQrTX1GIntNdvb/FylhMDxVwLZcRnH3facGIP3g=; b=fptBgdvqD86oG4/dX5DgaD6DcNTYqubjiO/IO8AaBVGu7dJGyI8iA9s7pLvUk4Ac8dgIMr w7/WVWzMvdK/n64wvR98v2geHRb3N+vhZl4KKFQ311refiQap6h4TNNDrEkfoMZGjLntor YClvYKlcoqndwK0rDh8iPIAQSQf7/Zk= Date: Mon, 6 Feb 2023 10:43:05 +0100 From: Borislav Petkov To: Linus Torvalds Cc: Christian Kujau , Juergen Gross , Michael Kelley , linux-kernel@vger.kernel.org, Greg KH , Linux regressions mailing list Subject: Re: External USB disks not recognized with v6.1.8 when using Xen Message-ID: References: <4fe9541e-4d4c-2b2a-f8c8-2d34a7284930@nerdbynature.de> <8f132803-f496-f33a-d2ab-b47fd5af0b88@nerdbynature.de> <0f441adb-f565-7a37-d9e5-3b14f6f7aea6@suse.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Feb 05, 2023 at 12:21:42PM -0800, Linus Torvalds wrote: > So this is the one I'd almost leave alone. > > Because this is not a "there are no MTRR's" situation, this is a "I > haven't enabled CONFIG_MTRR, so I don't _know_ if there are any MTRR's > or not. > > And returning MTRR_TYPE_UNCACHABLE will then disable things like > largepages etc, so this change would effectively mean that if > CONFIG_MTRR is off, it would turn off hugepage support too. Right, if we wanted to be precise here, we would check whether the underlying hw supports MTRRs - i.e., check CPUID bit - and if our support for it is disabled, then we'd return UC because this is how the MTRR-supporting hw behaves: "If the MTRRs are disabled in implementations that support the MTRR mechanism, the default memory type is set to uncacheable (UC)." That's the AMD APM. The Intel SDM has a similar wording: "Following a hardware reset, the P6 and more recent processor families disable all the fixed and variable MTRRs, which in effect makes all of physical memory uncacheable." So something like if (cpu_feature_enabled(X86_FEATURE_MTRR)) return MTRR_TYPE_UNCACHABLE; else return MTRR_TYPE_INVALID; > > @@ -721,8 +721,9 @@ int pud_set_huge(pud_t *pud, phys_addr_t addr, pgprot_t prot) > > u8 mtrr, uniform; > > > > mtrr = mtrr_type_lookup(addr, addr + PUD_SIZE, &uniform); > > - if ((mtrr != MTRR_TYPE_INVALID) && (!uniform) && > > - (mtrr != MTRR_TYPE_WRBACK)) > > + if (mtrr != MTRR_TYPE_UNCACHABLE && > > + mtrr != MTRR_TYPE_WRBACK && > > + !uniform) > > return 0; > > Here you make up for it, but I don't actually understand why these > checks exist at all. > > I *think* that what the check should do is just check for uniformity. Looka here: 6b6378355b92 ("x86, mm: support huge KVA mappings on x86") Ack on the uniformity aspect. The WB is fine too because "has no affect on the PAT memory types." And then when MTRRs are disabled, then I guess it doesn't matter for the large page mappings anyway. I would have said that we don't really care about MTRRs being disabled but all those new confidential computing things do disable MTRRs. Xen too. Thx. -- Regards/Gruss, Boris. https://people.kernel.org/tglx/notes-about-netiquette