Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp849767lqp; Thu, 23 May 2024 01:38:49 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXX0Q/f3vn6O05WS4k9L5hWzLer0K9J8fyRco1eVfBoVq8muknQhz/mB89JsJjsZunjckffbl/2zdHS4RUCJm6VCEvaOnaPke6hK4ZXVw== X-Google-Smtp-Source: AGHT+IFnR3/GxSgXVCmaWxZUNmg3gN0dE0pKJtB+XbatW7lyXWQA+kUjzfpWN+TAbTRueEimALbF X-Received: by 2002:ac2:447a:0:b0:523:9003:88a0 with SMTP id 2adb3069b0e04-526bf82caffmr2974736e87.39.1716453528911; Thu, 23 May 2024 01:38:48 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716453528; cv=pass; d=google.com; s=arc-20160816; b=K2zwg96bjiJc2vFl0JXNJ8ddoKhR8M7nBX9Ym7up5sYW2/7uRZ0uR/J4EE3FvC8D6R CZiB6DOiBN5iGbJWsQZA7OWijqvjmIctQ/rJC+aYbx/IDyxdPxQdsU/hTjvcEU9PQ3GD LMjg7ZMYwNlDWjcDgUZM1J83/UBaSJnNl9dhrhixGj9RyL/vq4WUjakuzgrnpGxwwLmw EQrlDYjw7vrvn935ueSZvfJozAJRttjkSwwfFrmpA06rxPxLwK1fO/FUQ76s2FtCRcRU oQiEEzTFVm0UgnA0ViKuBD/eFpFIiZ0FYavgJr5rvQdDfGLgAHYIErLQJZz5xjP8JzRS whgg== 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:date :subject:cc:to:from:dkim-signature; bh=k+IfxCQKHgdpqayrcGkCebIoovoMyjlXzAhylrymxYs=; fh=enVIPA8K8eBohMyhsnu6LWqbOxqLIyRDWnOG4TIs1Ro=; b=izfz3cRnDHkkQc45RZR2X2elUpDdt9Wq1bZn+Svj2qwwDQ6wPXdKeJc5FyyR7XEhOt oLbVbe/YPeU7Lc32izGGISoatkfpW71qC2ly3OeyH+l4MSoH3tWdzijKEwOmIkve8P97 ilhmPD3IcIDlMBa5BVgWUqNHDpM6kBJNhGh/fII2wU/gHQCk6rI7FcvCnysdYoffFGKq mOtO/3vTaYNUIS0TcK4FNBXwS2AS1s+nDHUK73fUYTbK7W7Kafks9M2cUc9xOxADj4ak eFc+ul+0YCZXE3pjMdqVPFVxM+vyXcNKh0TXc3p0F/rPrryy9DFgT+QfbRsqbrvT1fdf 6MdQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=P7p4bkBV; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-187185-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187185-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a3a018610si1485062366b.211.2024.05.23.01.38.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 01:38:48 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187185-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=P7p4bkBV; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-187185-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187185-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 am.mirrors.kernel.org (Postfix) with ESMTPS id 9CE331F21E87 for ; Thu, 23 May 2024 08:38:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1AE2813C918; Thu, 23 May 2024 08:38:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="P7p4bkBV" Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ABE5946AF for ; Thu, 23 May 2024 08:38:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.175 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716453521; cv=none; b=FyoAjAujQy0hBECTFf9W7iFC9HaUomqW77tFqNgTJdO2A/VQ1PhloITtpJrBTyK0mEoYqsexRcXRj/w/jY9LZ4ce4dn4fMPkE+osrd1NoI0G3V7NV/qfKti/Ej3buqTi5znAJ4clKClmbqajcVyfKhMbLPB1EdYyuU/CqT4CUAk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716453521; c=relaxed/simple; bh=2DnbGNeUW0lSTQX9F9+cvJ1Q17iPqnIj6m/nEOR0fO8=; h=From:To:Cc:Subject:Date:Message-Id; b=WyQJgqsEc2O4t9mnIey/NsJwR6qm59Q+dicSXKTXsRLC3+ZSe/TESUTkREX9GyXuDDm3gSZvGLNcIyldZG8yB4MC3o2UJqUarVZastb5HgVqAH4oovtyYT0BinN9UnShaXTThSR0ifhHW92ZwiIIQF+Oa4VVXGZPO+ferGjzV7A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=P7p4bkBV; arc=none smtp.client-ip=209.85.208.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2e428242a38so108449991fa.2 for ; Thu, 23 May 2024 01:38:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716453518; x=1717058318; darn=vger.kernel.org; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=k+IfxCQKHgdpqayrcGkCebIoovoMyjlXzAhylrymxYs=; b=P7p4bkBVBFSgowO/BZDRPwbYPznf0Iqh9rbIQ8Ro+iVDJoMHuKCVCN/kOUZQCAscf0 vpOsPOJM7i9N15OUppUCO5tnRfKK/QCZvvEinYIiHLhbOBNiExrK/ZwKvkHJV9/+6s+2 oUfb2OZrbG4znrX5EuWTwYCxxANL1xedat361Ju81yg9kyOzBTNdcYp54pX67w1hSzD9 pyTkcUmYAH1vhoQB6Qa7zEe8NjSSuHp6IM9s9C6VqelvSSGeBhTzcZPkey8Ai/YM3S4B 0k/kVer2IfaRTvpP2NIZ2b/hYXn8YiD7V/6xZx4Du2OXHlw7kyLQP3j2uRXz31YovDfZ KgIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716453518; x=1717058318; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=k+IfxCQKHgdpqayrcGkCebIoovoMyjlXzAhylrymxYs=; b=os6gf2QgTaYsDLnwcmTgwDeckgyhJO1+93yLrVfZ9k50A9EIRP48vcs2ZbXnd70Os4 cPJo0G0Ct12rzsaHU1jylqKGgzzB4tqoExbj5sLN+3aLmYRg3nDC6Yc7K5tOzdaAz/0Q nvuAI2gBWUCcgju0p7j2961UnJXsqd+3MQ/sk0Qe8K1vI81jyowAE8D/EwW1ZucPGZfX 4WjpdKhX923PJubjKb4C4Cj+IFrHIRWoK4syjplg/mgZo22tO+ZAWmm7JKQc2+vzzQC5 QCjIubyMs4rXDYzMAARgiKO1KVeswnOWR+JyiVTMaNJh+eHL63VR78+lt5mbUkLWQEJa JGpA== X-Forwarded-Encrypted: i=1; AJvYcCXHJJh+tNatXfyP+vUU+dQ4j5zjmKlr7vJ9tiWZki5G3BRRWPM2GySr8MPs44KAH9GjLhACAI3EAy5NOXHUXJ2BBOnHbcSyzbaXCbHi X-Gm-Message-State: AOJu0Yx1V8YCwQIsY/7c0OHWdBbG2s1bY6LTBHIpJHzJFmXHgx1ZKZiF Q8Th4YvrIEVZ/MP8N6kWcSN2cXUi8LTritlenSfdJgQsxFrJnDpB X-Received: by 2002:a2e:2c16:0:b0:2e0:6313:fe3a with SMTP id 38308e7fff4ca-2e949540d05mr35003951fa.35.1716453517388; Thu, 23 May 2024 01:38:37 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a5a51eea36dsm1655552466b.58.2024.05.23.01.38.36 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 May 2024 01:38:36 -0700 (PDT) From: Wei Yang To: tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Wei Yang , "Kirill A . Shutemov" , Ingo Molnar , Steve Wahl Subject: [Patch v2] x86/head/64: remove redundant check on level2_kernel_pgt's _PAGE_PRESENT bit Date: Thu, 23 May 2024 08:37:52 +0000 Message-Id: <20240523083752.11426-1-richard.weiyang@gmail.com> X-Mailer: git-send-email 2.11.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: This patch tries to remove a redundant check on kernel code's PMD _PAGE_PRESENT attribute before fix up. Current process looks like this: pmd in [0, _text) unset _PAGE_PRESENT pmd in [_text, _end] if (_PAGE_PRESENT) fix up delta pmd in (_end, 512) unset _PAGE_PRESENT Since we have compiled in _PAGE_PRESENT in this page table, it is not necessary to check _PAGE_PRESENT again before fixing up delta Signed-off-by: Wei Yang CC: Thomas Gleixner CC: Kirill A. Shutemov CC: Ingo Molnar CC: Steve Wahl --- v2: adjust the change log to emphasize the redundant check --- arch/x86/kernel/head64.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c index a817ed0724d1..bac33ec19aa2 100644 --- a/arch/x86/kernel/head64.c +++ b/arch/x86/kernel/head64.c @@ -260,8 +260,7 @@ unsigned long __head __startup_64(unsigned long physaddr, /* fixup pages that are part of the kernel image */ for (; i <= pmd_index((unsigned long)_end); i++) - if (pmd[i] & _PAGE_PRESENT) - pmd[i] += load_delta; + pmd[i] += load_delta; /* invalidate pages after the kernel image */ for (; i < PTRS_PER_PMD; i++) -- 2.34.1