All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christian Kujau <lists@nerdbynature.de>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Juergen Gross <jgross@suse.com>,
	Michael Kelley <mikelley@microsoft.com>,
	 Borislav Petkov <bp@alien8.de>,
	linux-kernel@vger.kernel.org,
	 Greg KH <gregkh@linuxfoundation.org>,
	 Linux regressions mailing list <regressions@lists.linux.dev>
Subject: Re: External USB disks not recognized with v6.1.8 when using Xen
Date: Fri, 3 Feb 2023 17:50:17 +0100 (CET)	[thread overview]
Message-ID: <4973310d-005b-5228-78c8-74cf353f05a9@nerdbynature.de> (raw)
In-Reply-To: <CAHk-=wg1yXaX+Ut4uctf7x1WrZ4WW9hjSCr1VACwZtkZT9frFw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1296 bytes --]

On Thu, 2 Feb 2023, Linus Torvalds wrote:
> So I think that commit should be reverted as broken, and then people
> should *maybe* look at something like this (intentionally whitespace
> damaged, and people should *really* think about what the
> MTRR_TYPE_INVALID case should be - returning UC- is probably what is

Not fully understanding what your proposal really does, I got curious and 
applied it to v6.2-rc6 with 90b926e68f50 (upstream) reverted. And it 
boots, and the disks are there, and the "ioremap error" is gone, but now 
I've got strange memory allocation errors, for like really small 
operations (I wanted to capture dmesg):

  $ dmesg -t | xz -9ec | base64 
  xz: (stdin): Out of memory

With v6.2-rc6 (vanilla, and also booted under Xen) there's no problem 
allocating much more memory than that, so something is still not right. 
Patch applied for reference, but as you said: nobody should apply this :-)

More details:

- https://nerdbynature.de/bits/usb_v6.1.8/dmesg.6.1.8.xen
- https://nerdbynature.de/bits/usb_v6.1.8/dmesg_xen-6.1.8_MTRR_TYPE_INVALID.txt
- https://nerdbynature.de/bits/usb_v6.1.8/meminfo_xen-6.1.8.txt
- https://nerdbynature.de/bits/usb_v6.1.8/meminfo_xen-6.1.8_MTRR_TYPE_INVALID.txt

Thanks,
Christian.
-- 
BOFH excuse #448:

vi needs to be upgraded to vii

[-- Attachment #2: Type: text/plain, Size: 1317 bytes --]

commit 56a159efebc0
Author: Christian Kujau <lists@nerdbynature.de>
Date:   Fri Feb 3 17:13:33 2023 +0100

    MTRR_TYPE_INVALID fixes as proposed by Linus.

diff --git a/arch/x86/include/asm/mtrr.h b/arch/x86/include/asm/mtrr.h
index f0eeaf6e5f5f..38ded2762847 100644
--- a/arch/x86/include/asm/mtrr.h
+++ b/arch/x86/include/asm/mtrr.h
@@ -53,7 +53,8 @@ static inline u8 mtrr_type_lookup(u64 addr, u64 end, u8 *uniform)
 	/*
 	 * Return no-MTRRs:
 	 */
-	return MTRR_TYPE_INVALID;
+	*uniform = 1;
+	return MTRR_TYPE_INVALID; /* ??? */
 }
 #define mtrr_save_fixed_ranges(arg) do {} while (0)
 #define mtrr_save_state() do {} while (0)
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c
index ee09d359e08f..0d77998b90ea 100644
--- a/arch/x86/kernel/cpu/mtrr/generic.c
+++ b/arch/x86/kernel/cpu/mtrr/generic.c
@@ -261,11 +261,13 @@ u8 mtrr_type_lookup(u64 start, u64 end, u8 *uniform)
 	/* Make end inclusive instead of exclusive */
 	end--;
 
+	type = MTRR_TYPE_INVALID; /* ??? */
 	if (!mtrr_state_set)
-		return MTRR_TYPE_INVALID;
+		goto out;
 
+	type = mtrr_state.def_type;
 	if (!(mtrr_state.enabled & MTRR_STATE_MTRR_ENABLED))
-		return MTRR_TYPE_INVALID;
+		goto out;
 
 	/*
 	 * Look up the fixed ranges first, which take priority over

  reply	other threads:[~2023-02-03 16:50 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-30  3:46 External USB disks not recognized with v6.1.8 when using Xen Christian Kujau
2023-01-30  5:17 ` Greg KH
2023-01-30 12:01 ` Linux kernel regression tracking (#adding)
2023-01-31 22:50   ` Christian Kujau
2023-02-01  8:14     ` Juergen Gross
2023-02-01  9:37       ` Christian Kujau
2023-02-02 11:38       ` Christian Kujau
2023-02-02 20:24         ` Linus Torvalds
2023-02-03 16:50           ` Christian Kujau [this message]
2023-02-03 17:29             ` Christian Kujau
2023-02-05 13:20           ` Borislav Petkov
2023-02-05 17:17             ` Christian Kujau
2023-02-05 20:21             ` Linus Torvalds
2023-02-06  6:33               ` Juergen Gross
2023-02-06  9:54                 ` Juergen Gross
2023-02-06  9:43               ` Borislav Petkov
2023-02-05 10:40     ` Linux kernel regression tracking (#update)
2023-02-14  9:35 ` [tip: x86/urgent] x86/mtrr: Revert 90b926e68f50 ("x86/pat: Fix pat_x_mtrr_type() for MTRR disabled case") tip-bot2 for Juergen Gross
2023-02-18  9:47   ` Christian Kujau
2023-02-18  9:59     ` Borislav Petkov
2023-05-08 13:41     ` [tip: x86/cleanups] Documentation/process: Explain when tip branches get merged into mainline tip-bot2 for Christian Kujau
2023-05-15 15:28     ` tip-bot2 for Christian Kujau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4973310d-005b-5228-78c8-74cf353f05a9@nerdbynature.de \
    --to=lists@nerdbynature.de \
    --cc=bp@alien8.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikelley@microsoft.com \
    --cc=regressions@lists.linux.dev \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.