Message ID | 20240222190911.1903054-1-yosryahmed@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-77223-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp153312dyb; Thu, 22 Feb 2024 11:11:39 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXCTxB4HvaYgHXWAo9SgEdYi8y3srkKVn06jk6WXHsdZ033Q38u+d9/N2Zk62eLRir56xVyIiYQy3gFRngVjrGpsyhMfA== X-Google-Smtp-Source: AGHT+IH7ykXdnD0wdPrcgaYA6vwnkMmDWsAGb54C0RkLeCtzvwMPlkjFgJPtrPmp23KEuI+nTozV X-Received: by 2002:a05:620a:468c:b0:787:9304:84 with SMTP id bq12-20020a05620a468c00b0078793040084mr5052108qkb.21.1708629098995; Thu, 22 Feb 2024 11:11:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708629098; cv=pass; d=google.com; s=arc-20160816; b=DMO3trRZJYKmdDjaHgzyb0IONaAqSB3XUGWxw2sNplM0C4O0QpsD4rcmL/mNntgC1s HV5mV9K7BHggewq34CjvvJekGLMY1oKBSYECbmkrnEMXAeTr/cgtMaOJnKg8j0Q7nV51 MLhSi2Bv61e5OHrhe/qkXeLHIYfmimQbHKMgK60rx+0F43sVoL+fiA7164OHXfqylAAi aF67yvrYUxtyV2IQbzTucAC5/uEbYMP6wXPpVWPuRkVHkXZyf/jDcU0ncqvKuPVvEBfZ waKRAXY7qHwFxFeE8AcWRW2LR3r6BMX2RlZLnACNiIxrbHFvPrBuE99LfYXgoiTygtMM kbow== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature; bh=nIzMjlB25RgjrxXtl1pB1geOeDMH3Njm73h3nfH079U=; fh=GRVBj1XRQ3e1aELnFU/J5ePJNAP8phS+jdaNwcHT4zY=; b=aav4OAsgUJkmHNlhH0N+mmVO/CeyIgtaYhVqwfph3zwjxozTNVy0a+4a/VIt8LF8uI ptfrtb6PyCQfxcKbnWpKMQrG2vmCfZ1uyBHHWkMGEREwU9b+Wsk/PLeerOrR4j4JYbIN KwSBne6l7q3rjRM7E5AqE7hxDHmMeKcCaujbwmM2feJpSsC4vFxHrnsrcaTIC4L3j9br GrGcGw6jZ0IdynsE9Bz1/nOg6Jn7upLFA5P1kss/zmPWhnb/c9uxHlTdc34iMpvmg/Cs xCrrOxOPnwUlwQwDzWrYVRVOJaOABn+ZvI7D1jncfYOq9cT7qGKAQK/qwgf+53iJggKm brcg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=YnvXnOuw; arc=pass (i=1 spf=pass spfdomain=flex--yosryahmed.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-77223-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77223-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id f5-20020a05620a20c500b0078786192e61si3912468qka.501.2024.02.22.11.11.38 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 11:11:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77223-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=@google.com header.s=20230601 header.b=YnvXnOuw; arc=pass (i=1 spf=pass spfdomain=flex--yosryahmed.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-77223-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77223-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.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 E25681C26348 for <ouuuleilei@gmail.com>; Thu, 22 Feb 2024 19:10:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C44636E5F5; Thu, 22 Feb 2024 19:09:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="YnvXnOuw" Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) (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 BE13D14B815 for <linux-kernel@vger.kernel.org>; Thu, 22 Feb 2024 19:09:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708628956; cv=none; b=ULwnxjfGAxT9ckcDKNwRmA/IoHphzewyBCA0D3H086iY5akxzXpms2AMy3QyNUoO7I9dsRNBWpZ1ZIXpNXHc0kWbJLwGKv4r2+LR8hbjpobQWI8yjDFK3/yw1IyIQt6OQTNPVCwwl1mqgLu2sOjdHwh4KYevVf0eBokz7Ac0pbs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708628956; c=relaxed/simple; bh=qMCWVXQCkH7/OsVC8XV8wlWhGBfIObVlwCTkLB6YOOE=; h=Date:Mime-Version:Message-ID:Subject:From:To:Cc:Content-Type; b=PaQ7sLHgeLqz90xkEfIU1e9MQgTbrRF2lX4xDQTRrKIxsN8J2xLA29fIwLg31cjI56VSGq6oEgKakNAMXP1/MX+EJdO9AxkKywOcIgjb1IElvGaJPkFbEAVIc7WkihizRGgYfBgb5OGVK2MUJaWx5vp5aZI1VSfdBwi/0lCH0r8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--yosryahmed.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=YnvXnOuw; arc=none smtp.client-ip=209.85.219.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--yosryahmed.bounces.google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc6ade10cb8so303776276.0 for <linux-kernel@vger.kernel.org>; Thu, 22 Feb 2024 11:09:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708628953; x=1709233753; darn=vger.kernel.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=nIzMjlB25RgjrxXtl1pB1geOeDMH3Njm73h3nfH079U=; b=YnvXnOuws707cMoTDh+7wSc7NDDp47PM2vWtPE6A9K9+oWNJ0YlBbcnUqBpKE6ej7U t+mGJeecc2iCJYT0Kh83xvl77zm8khaKraP0jntNSCpt1TkPORv70uwthyGwbUlwgwGJ yAyW5rvcPnqikmjJh4AF2vNN/8jkPDNVk7Yp+DoSeY2eumbSmPi6QcclG6yM/NEv7h33 w6+SLa4BbP66USwmlEWcbOqS8AL7zlZsQhJyUMB2xqenwFOcDe/LnI8+bLLVGoXnazJr r7WAeUrHIHF8L5BvEonoVQk1LuKG1RcXMlf7VDTmOXUVr0FP5GJ874jRagaXJMURzwou Ux9w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708628953; x=1709233753; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=nIzMjlB25RgjrxXtl1pB1geOeDMH3Njm73h3nfH079U=; b=F5YjSowNb/8srVc8BIcXoT5pvN/a9VdTzA4uOLPqe+mveZz34eNsNXI90AQ0+xAGxv GpI1Ojien4rerC/3bd3y0VFEJl84hCwSrFYfQ0RB3DBt1cS2LUg4BKLixF2VN1WT9Rz+ 7dTYw2mjmhhkJY3Dmn4XK3xU3ZZrkbBf9DA4LezQoVt1b9VCLsAV/ZVs8woGLiSp9pvo 9h01t8otcrxfB67YGpoNtBR+emXchCGPzshwA97Nbi0+ybYzfrt7PXvxSNCfZfn7mBzN M3KpZmlIo60f/OkrvKpGHmQlDhj3x4DWmq5YalRZQdZNR8iphtLsab1nBTEIpiA7s4f+ 5Kxg== X-Forwarded-Encrypted: i=1; AJvYcCXhGMc+AreF0q3/6VgvBzrf3rm6sxEaKc80YzA0k+UIi2y3leCYlc25eNAWqS1UnJ6lyeAviUomfoODHt3hva1P8u1MD5tl9veiKgJ+ X-Gm-Message-State: AOJu0YyRnXFAOx5u2bvg/o5kzDdqX/CNCQcU+qOzwqAl38gHqWIoDFvY inHnD6y6rQr6NrJUcJqqGC9XyFc+FGTaAe+Y8ttgontKYdQUM8bnVfOmrhUuFFve93zKc7y3UED oGx/fX4uPk/l4Ppa76Q== X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:29b4]) (user=yosryahmed job=sendgmr) by 2002:a25:7496:0:b0:dcc:5463:49a8 with SMTP id p144-20020a257496000000b00dcc546349a8mr657549ybc.6.1708628953740; Thu, 22 Feb 2024 11:09:13 -0800 (PST) Date: Thu, 22 Feb 2024 19:09:10 +0000 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> Mime-Version: 1.0 X-Mailer: git-send-email 2.44.0.rc1.240.g4c46232300-goog Message-ID: <20240222190911.1903054-1-yosryahmed@google.com> Subject: [PATCH mm-stable 1/2] x86/mm: further clarify switch_mm_irqs_off() documentation From: Yosry Ahmed <yosryahmed@google.com> To: Andrew Morton <akpm@linux-foundation.org> Cc: Dave Hansen <dave.hansen@intel.com>, Ingo Molnar <mingo@redhat.com>, Thomas Gleixner <tglx@linutronix.de>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, Andy Lutomirski <luto@kernel.org>, Peter Zijlstra <peterz@infradead.org>, x86@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yosry Ahmed <yosryahmed@google.com> Content-Type: text/plain; charset="UTF-8" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791627466078175700 X-GMAIL-MSGID: 1791627466078175700 |
Series |
[mm-stable,1/2] x86/mm: further clarify switch_mm_irqs_off() documentation
|
|
Commit Message
Yosry Ahmed
Feb. 22, 2024, 7:09 p.m. UTC
Commit accf6b23d1e5a ("x86/mm: clarify "prev" usage in
switch_mm_irqs_off()") attempted to clarify x86's usage of the arguments
passed by generic code, specifically the "prev" argument the is unused
by x86. However, it could have done a better job with the comment above
switch_mm_irqs_off(). Rewrite this comment according to Dave Hansen's
suggestion.
Fixes: accf6b23d1e5 ("x86/mm: clarify "prev" usage in switch_mm_irqs_off()")
Suggested-by: Dave Hansen <dave.hansen@intel.com>
Signed-off-by: Yosry Ahmed <yosryahmed@google.com>
---
arch/x86/mm/tlb.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
Comments
On 2/22/24 11:09, Yosry Ahmed wrote: > Commit accf6b23d1e5a ("x86/mm: clarify "prev" usage in > switch_mm_irqs_off()") attempted to clarify x86's usage of the arguments > passed by generic code, specifically the "prev" argument the is unused > by x86. However, it could have done a better job with the comment above > switch_mm_irqs_off(). Rewrite this comment according to Dave Hansen's > suggestion. Looks good, thanks for sending this! Acked-by: Dave Hansen <dave.hansen@intel.com>
On 2/22/24 11:09, Yosry Ahmed wrote: > The first argument of switch_mm_irqs_off() is unused by the x86 > implementation. Make sure that x86 code never passes a non-NULL value to > make this clear. Update the only non violating caller, switch_mm(). Acked-by: Dave Hansen <dave.hansen@intel.com>
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c index bf9605caf24f7..b67545baf6973 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c @@ -493,10 +493,10 @@ static inline void cr4_update_pce_mm(struct mm_struct *mm) { } #endif /* - * The "prev" argument passed by the caller does not always match CR3. For - * example, the scheduler passes in active_mm when switching from lazy TLB mode - * to normal mode, but switch_mm_irqs_off() can be called from x86 code without - * updating active_mm. Use cpu_tlbstate.loaded_mm instead. + * This optimizes when not actually switching mm's. Some architectures use the + * 'unused' argument for this optimization, but x86 must use + * 'cpu_tlbstate.loaded_mm' instead because it does not always keep + * 'current->active_mm' up to date. */ void switch_mm_irqs_off(struct mm_struct *unused, struct mm_struct *next, struct task_struct *tsk)