On Sun, Dec 9, 2018 at 7:25 AM Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote: > > Cc: Dan (Dan, it seems in the file mentioned in the bug the only > change between affected and non-affected verions is yours) > > Thanks for the report! Thanks for forwarding, can you give the attached patch a try to get more information? We should remove the BUG_ON() regardless of the outcome, reserve_memtype() failures should not bring down the system.
From 5be0556e589c21b3b931f95c1bf3d6a378c07caf Mon Sep 17 00:00:00 2001 From: Dan Williams <dan.j.williams@xxxxxxxxx> Date: Sun, 9 Dec 2018 09:09:50 -0800 Subject: [PATCH] Debug physical address sanitization conflict. --- arch/x86/mm/pat.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c index 08013524fba1..225d89e24e38 100644 --- a/arch/x86/mm/pat.c +++ b/arch/x86/mm/pat.c @@ -540,13 +540,21 @@ int reserve_memtype(u64 start, u64 end, enum page_cache_mode req_type, enum page_cache_mode *new_type) { struct memtype *new; + u64 s_start, s_end; enum page_cache_mode actual_type; int is_range_ram; int err = 0; - start = sanitize_phys(start); - end = sanitize_phys(end); - BUG_ON(start >= end); /* end is exclusive */ + s_start = sanitize_phys(start); + s_end = sanitize_phys(end); + if (s_start >= s_end) { + pr_err("%s failed [mem %#010Lx-%#010Lx], [s_mem %#010Lx-%#010Lx], type: %s\n", + __func__, start, end - 1, s_start, s_end - 1, + cattr_name(req_type)); + return -EINVAL; + } + start = s_start; + end = s_end; if (!pat_enabled()) { /* This is identical to page table setting without PAT */ -- 2.17.2