Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp964293lqp; Thu, 23 May 2024 05:36:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX5j/4oVWm01bj5d1fJcUK+/GLeRBg0JCZcNbQu3S2w/zmTCNXoTeeBc/oPXLN4GrNRb7dSWY+2MBB9/VhVvw813jkZmqVeSZedtJAACQ== X-Google-Smtp-Source: AGHT+IFPMIyfdnMjvXjot8w/B54qDJGCG9m+XImhPkT5s41RstFcGZ4E2qiO2GAi7wKqp1rufEvV X-Received: by 2002:a17:903:245:b0:1f2:f921:7c4d with SMTP id d9443c01a7336-1f31c9dbd39mr53059275ad.54.1716467788214; Thu, 23 May 2024 05:36:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716467788; cv=pass; d=google.com; s=arc-20160816; b=NsVoe78IYG60ljfgSevAvjCU3V+N4XmxeZEYMsDuy8rZ3Iwf/J0yAVdkeSzwllMQdm AzmRoHmdDoZPO0fk0ZLc7uTO2wd8mW59NJ7svVlhI2YcvNql7MHFlZwha78pY/zmItkO cq6CgJg48GvBpfn0KwowbzTPpWC75lNK+Yo0RNEdHx6r9o5OyFkevppUZ7FrrbxwdnfL uAJBoQVXjQOWTtUSZeY5mqckUf25Ku2rq2OtjVJs8t72RWHHekvoe2hNn7yCCGXl3ah0 HqrQfTvZgfyoaamBB0/jyv6hXlgxoITY/eFjboYvMQby2FnJhRbTtgFnyKpzAFylXWqs NMKg== 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=K8lRq3lXsKaaPmtAV1QU0P9el+kdsmzCNC+w8uH7qfk=; fh=CA11+/SusOqCY8i4gx/P3eiJpw6eMe0K1jGs4lZHbic=; b=c7tiB7o3zVBtcSFtS5A6ra8dPVaXTAOgnTDd3aWeBYLpRqnBrQ5XEs55untr5d7yG2 vR4w5MfS4JG36Zf1pZ9FlfldOf8qDbNw+4C7rDIYubs2OOG7t2Xep5+iGrkuNiPsJMeB z492jaEfKciCEhMjtsUx+DKCvm+oOvTTIlFoXSknmMluVAC6+Q7qohjv5GeoF3O/MI1i THX9Klmc6w4wuhRvgGu8u4r2R86khL4zDAAcu5j7whT1h3FsaPvzR1n1eH8y12HwLmnB LNdc1EWPO8tir1pgVZoieV+sRuNqxHLzLpSnTpJk9N/v5d5Z853Srdf8bx1+62v8NYH9 dr7w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="Nho/kuZV"; 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-187477-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187477-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id d9443c01a7336-1f31321a0b3si41909235ad.79.2024.05.23.05.36.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 05:36:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-187477-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="Nho/kuZV"; 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-187477-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-187477-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D997A2820C1 for ; Thu, 23 May 2024 12:36:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 43E511487DB; Thu, 23 May 2024 12:36:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Nho/kuZV" Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (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 C22011E4A0 for ; Thu, 23 May 2024 12:36:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716467782; cv=none; b=T7CWI0h2YdNShO671AJ32MXSQZLC6/aI2yL027pcBTeAjNb2V/szZ2dPTCQr2XWYLV2gloKdfCzt5EsSss8kkdtpkFKqo/WcY+iOoMojDJ7+Qfplash6cjDUKYXXqPPPGtKus+KedYr9tRnWCDK5IDJyMr44tj8teyrvptN17QM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716467782; c=relaxed/simple; bh=m6UgnpbMbTrWQXZDKtHkcHfxNFrx8RIBUE5CV8NUdwQ=; h=From:To:Cc:Subject:Date:Message-Id; b=j4qZDEopgnDLdJOKUFQnC2SObvbcfA+ldsjBDUlGPnQqQzO7mhDQWG3t1HvFA1/ckiRemLYAUIIsKJrjsbdA3bdZJ+DRD6v3dwuJ73Qfl/VsMGh8bKVJNKFzCDkQZR/jAQBwOjXKbGftjaB4Oz8m+08LJgIWchlqIaCfZtmBCQc= 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=Nho/kuZV; arc=none smtp.client-ip=209.85.167.52 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-lf1-f52.google.com with SMTP id 2adb3069b0e04-51fc01b6fe7so6646485e87.0 for ; Thu, 23 May 2024 05:36:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716467779; x=1717072579; darn=vger.kernel.org; h=message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=K8lRq3lXsKaaPmtAV1QU0P9el+kdsmzCNC+w8uH7qfk=; b=Nho/kuZVCueIRFvS5mYOvkIpRwRZlavQL01TI2hNjavZRDAhnUQwJ0P/wCZN7AeFQJ T10PrUfKxcKbTwjh4MuacTy0gFFAuWbw8A1grJVypC4RY35idwwyEFy0DYd5NsxHz31K /f/EeQGwPOxmdZADZXmAq9TkAVCPVXELej/pc8/OkBisZA7d93TSpq0BA3JMW+s5EEL1 0LOYaKN0rYrU6QuxpSgxvZfxQXsVPDGqp8S5hT8D9tR8EUzt8U9rcbX4bIJKjHrHsMso CUhUNIvVtl8bqQmqyi2i/37iGjb/Pijnz1xxgLzSWbll61a2RibPvwIxmtV5ZH3CBJou TOXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716467779; x=1717072579; h=message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=K8lRq3lXsKaaPmtAV1QU0P9el+kdsmzCNC+w8uH7qfk=; b=JFsgGTwXG5NSr95z4sUbqXyQn1taLo43G7SFsDihV4VU4s9gFyIoE8FDS0BYVevJwl yhP3UDDiORCeujnPz9L1aK5jP9YyvibITyxqdojFqmmlyPt5/CM0jLTqxaV+Atck39CF 4lZowevynn76EtwvP5NGiaAk0uz49MGKIKJmui64Q19OVJXazptefilutTtEHXskDpkc SyNczmy2/6g7Qm8sjY9xJXyAE8Jk+mRBpyT/bRGb0bG65Wf5HhFK8Zl31djLx6mrcJNE /VNwZ+E43qkg87ZXxr1WZYlZJzanQLbUJSUj31jBkzyPsOZr8JzvNkPnjr6vSD3YZWKr RoRw== X-Forwarded-Encrypted: i=1; AJvYcCWnwGdUx42DKHJk7svRfamREHO/HDV9kCt6HDm5izaTevnyFa96eT8rFQuEHttxzUbspAeamL3Vc0sOKMW7xd9Wjd8pkFPCBCcAqIMh X-Gm-Message-State: AOJu0Yw4701Kk6YaQu/lKJxrllktMYyO5WE4VFMs76HCg71VXOMCo2ta axRRMB7ebgHZEFDp4IlHkz7MoVaXTTWtTOhIgXptwblA5QrvT6km X-Received: by 2002:a19:7511:0:b0:523:e756:2838 with SMTP id 2adb3069b0e04-526bdc5255fmr2777702e87.39.1716467778569; Thu, 23 May 2024 05:36:18 -0700 (PDT) Received: from localhost ([185.92.221.13]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-578366176e9sm2388421a12.74.2024.05.23.05.36.17 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 23 May 2024 05:36:18 -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 v3] x86/head/64: remove redundant check on level2_kernel_pgt's _PAGE_PRESENT bit Date: Thu, 23 May 2024 12:35:39 +0000 Message-Id: <20240523123539.14260-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: 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 level2_kernel_pgt compiled with _PAGE_PRESENT set. The check is redundant Signed-off-by: Wei Yang CC: Thomas Gleixner CC: Kirill A. Shutemov CC: Ingo Molnar CC: Steve Wahl --- v3: refine the change log per kirill's comment 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