From patchwork Thu Feb 22 18:39:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Hansen X-Patchwork-Id: 205029 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp176723dyb; Thu, 22 Feb 2024 12:00:20 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWIXtHkPc8aTqfTkSI95pNqZNZkdTVZZ1MfkCCvROxxRwe7kUrx6qAIcjqOi7pB4P0f5V2XZCF8w2bwe5lr7lH0CbfigQ== X-Google-Smtp-Source: AGHT+IHzuI8aYFKAIpglaNaRIUPZM0I//wR2yuEU1qJQX8T9ZmSJsQNVYCE16s2ppOj0Cm/AJo/F X-Received: by 2002:a05:6214:230b:b0:68f:6314:e130 with SMTP id gc11-20020a056214230b00b0068f6314e130mr213264qvb.59.1708632020678; Thu, 22 Feb 2024 12:00:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708632020; cv=pass; d=google.com; s=arc-20160816; b=1AcXzeGxDS27YDiI5xqXiCbaRgbeVmuyMhWhbF9TRDNmqoHb+OIa/2F7fN3aVRuQCc WMBDinQ0coLInMMPzec4slzeB6M/84QIkt88KowYuJnOd7TBf2xFrDWkUUe++o51pJZ1 4r8D+6AtLo7b5u/49PWHY0g1t5vCQx0hpyGYdqQcolzIixR8/pq5DNB72ky9enR3F2g1 yy9LAz+frmQpkx7dp17DYTk70pzuRSFR+cKsPwotU9z9+n6ugIpa5+7KJQzgXv4gvhXb 2/ZwyzMTCBIiCyoJAI29xiLokra/fQ+vrG2fP/M/RBYK5x9VDZoe1GkBm8jLMJzdjs36 jJ9A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:message-id :in-reply-to:references:date:from:cc:to:subject:dkim-signature; bh=D1xRWi9U0yhojPXJE3o5bjLPkSW80R/pGw6Kwqvm1X0=; fh=xj59RmQDS9mmOGS7FeYRHGvCt6y/iPU5U+DbB/Pwa4E=; b=0xsjckz0ZbLf2fRePjExe/FzyW/d3Xr4S8OGetAdt3TUS3bldrbj+fm5HpchGnq1+w vMEB31iIsWIuJH4znE0mpEBuVI7UMHACUFhyqbotE3jQItQcdRZ6abT87U01TRU+86cD E9o0c5MeJvdRHubjaAZAr0jEPsObxB4XTxER+RG405e1sn4U9dFJSpfiEZBnU2e0jQXM SY7m7r6946O7OioAYTJHZw2an+CScNKilmptoQaw95YAbbrktN4FRPobuK+hw2soalFO NXVSn4Gnw5RZtEaU5F933EseGHNr1AGuRmWXK2DkpkABSubmoC/dadJIWesooipeg5E/ +Nag==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CoSQBoF7; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-77156-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77156-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d5-20020a05621421c500b0068f761b112esi9023724qvh.357.2024.02.22.12.00.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 12:00:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77156-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=CoSQBoF7; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-77156-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77156-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 806171C24D68 for ; Thu, 22 Feb 2024 18:43:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B4DF56AFBA; Thu, 22 Feb 2024 18:39:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="CoSQBoF7" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3765E548EA for ; Thu, 22 Feb 2024 18:39:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.16 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708627171; cv=none; b=UcN9lLeTtZnPyt2R9Jhn+GLKTlKDOWXlnAlrFv2/eFeRSuHcR7Yod3G84Lm5fC1SIGlqEWZweVAeJ+D3eRf+MjXzSDf/kSLbam2j5hnmqGcvMva+KUUgsBGMXEfVd3/Ro04kI9Z39kSRFc/oNQsPbglrcM0aXbNbqjPaMBYd8nA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708627171; c=relaxed/simple; bh=BPPylVdwVb0qsjnFOdjrkJjwVsPFVOkQjGFT9BiJDoA=; h=Subject:To:Cc:From:Date:References:In-Reply-To:Message-Id; b=bGtf2uxpZI+m2mQf0LvOZA4rbU131H1YrbCTxl5/kvP/ZUsWfCKOJ0/H86asBrsJ8gKXaqbcUTFDy2s/D2KEmEpEVnXu8mxKa+bmSw9RHp/bA9LS0qOCBUqoBKrbC9NxDBV6QV3P+ytmM3dlGoDc+plzjtGhA2uvd6AKo87qZ2E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=CoSQBoF7; arc=none smtp.client-ip=198.175.65.16 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708627171; x=1740163171; h=subject:to:cc:from:date:references:in-reply-to: message-id; bh=BPPylVdwVb0qsjnFOdjrkJjwVsPFVOkQjGFT9BiJDoA=; b=CoSQBoF7OJhhgetU9+kqSkODrwERp43kUg8OpMLShjc2ue8GPE4+3Bwj bZzh6ERdae+jQiCZnTppWst0keM/wcCPO4LxFnLS6E1Uun7RF79fT03PJ feQPrpt7T1CBZnDN73UeBzJoInMFRJGLG+gE3+kOC0WTRI0g33UDEkZCm gkNXlfRPEEeyCyoMBHWjMdkaJSIKVBR9BX8/P+HFPNSydE6PwcSCEWPDc X2t4qy1gyA9/oXlv4bwRXwqs1s6ufCslEy4KrHF2kyYDpdUq9c6VOA7VE EyZTveECGEwNCNz+sIdQ9rBa6IuCLymiEt/WfueV8gOkJY2qftlAvH/oh Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10992"; a="3031690" X-IronPort-AV: E=Sophos;i="6.06,179,1705392000"; d="scan'208";a="3031690" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 22 Feb 2024 10:39:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,179,1705392000"; d="scan'208";a="5975371" Received: from davehans-spike.ostc.intel.com (HELO localhost.localdomain) ([10.165.164.11]) by orviesa008.jf.intel.com with ESMTP; 22 Feb 2024 10:39:30 -0800 Subject: [RFC][PATCH 02/34] x86/xen: Remove early "debug" physical address lookups To: linux-kernel@vger.kernel.org Cc: kirill.shutemov@linux.intel.com,pbonzini@redhat.com,tglx@linutronix.de,x86@kernel.org,bp@alien8.de,Dave Hansen ,jgross@suse.com From: Dave Hansen Date: Thu, 22 Feb 2024 10:39:29 -0800 References: <20240222183926.517AFCD2@davehans-spike.ostc.intel.com> In-Reply-To: <20240222183926.517AFCD2@davehans-spike.ostc.intel.com> Message-Id: <20240222183929.E17C1B9C@davehans-spike.ostc.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791630529771006960 X-GMAIL-MSGID: 1791630529771006960 From: Dave Hansen The __pa() facility is subject to debugging checks if CONFIG_DEBUG_VIRTUAL=y. One of those debugging checks is whether the physical address is valid on the platform. That information is normally available via CPUID. But the __pa() code currently looks it up in 'boot_cpu_data' which is not fully set up in early Xen PV boot. The Xen PV code currently tries to get this info with get_cpu_address_sizes() which also depends on 'boot_cpu_data' to be at least somewhat set up. The result is that the c->x86_phys_bits gets a sane value, but not one that has anything to do with the hardware. In other words, the CONFIG_DEBUG_VIRTUAL checks are performed with what amounts to garbage inputs. Garbage checks are worse than no check at all. Move over to the "nodebug" variant to axe the checks. Signed-off-by: Dave Hansen Cc: Juergen Gross --- b/arch/x86/xen/enlighten_pv.c | 2 +- b/arch/x86/xen/mmu_pv.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff -puN arch/x86/xen/enlighten_pv.c~xen-no-early-__pa arch/x86/xen/enlighten_pv.c --- a/arch/x86/xen/enlighten_pv.c~xen-no-early-__pa 2024-02-22 10:08:48.868469363 -0800 +++ b/arch/x86/xen/enlighten_pv.c 2024-02-22 10:08:48.872469519 -0800 @@ -1452,7 +1452,7 @@ asmlinkage __visible void __init xen_sta boot_params.hdr.type_of_loader = (9 << 4) | 0; boot_params.hdr.ramdisk_image = initrd_start; boot_params.hdr.ramdisk_size = xen_start_info->mod_len; - boot_params.hdr.cmd_line_ptr = __pa(xen_start_info->cmd_line); + boot_params.hdr.cmd_line_ptr = __pa_nodebug(xen_start_info->cmd_line); boot_params.hdr.hardware_subarch = X86_SUBARCH_XEN; if (!xen_initial_domain()) { diff -puN arch/x86/xen/mmu_pv.c~xen-no-early-__pa arch/x86/xen/mmu_pv.c --- a/arch/x86/xen/mmu_pv.c~xen-no-early-__pa 2024-02-22 10:08:48.872469519 -0800 +++ b/arch/x86/xen/mmu_pv.c 2024-02-22 10:08:48.872469519 -0800 @@ -2006,7 +2006,7 @@ void __init xen_reserve_special_pages(vo { phys_addr_t paddr; - memblock_reserve(__pa(xen_start_info), PAGE_SIZE); + memblock_reserve(__pa_nodebug(xen_start_info), PAGE_SIZE); if (xen_start_info->store_mfn) { paddr = PFN_PHYS(mfn_to_pfn(xen_start_info->store_mfn)); memblock_reserve(paddr, PAGE_SIZE);