From patchwork Tue Jul 2 13:21:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13719627 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id E88BCC30658 for ; Tue, 2 Jul 2024 13:21:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 56F026B0092; Tue, 2 Jul 2024 09:21:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4F80C6B0095; Tue, 2 Jul 2024 09:21:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 371C56B0096; Tue, 2 Jul 2024 09:21:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 1454D6B0092 for ; Tue, 2 Jul 2024 09:21:46 -0400 (EDT) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id ACD631621A3 for ; Tue, 2 Jul 2024 13:21:45 +0000 (UTC) X-FDA: 82294874970.12.4A621AB Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf12.hostedemail.com (Postfix) with ESMTP id 0901B40012 for ; Tue, 2 Jul 2024 13:21:43 +0000 (UTC) Authentication-Results: imf12.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=uPhJc6DX; spf=pass (imf12.hostedemail.com: domain of 35v6DZgoKCC8jZdcjLSXPORZZRWP.NZXWTYfi-XXVgLNV.ZcR@flex--yosryahmed.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=35v6DZgoKCC8jZdcjLSXPORZZRWP.NZXWTYfi-XXVgLNV.ZcR@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1719926481; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=hhKXhYrzfxh/rcH5rhg00qdwvGaDRGv233TWfBtt8ow=; b=5GhOUANPtbai4HcY6Xj4dQqDdKXY+7KJDjzNTh8caGeSTFW9mdmqM/kvBvLLOlKvEKMuWC Lc71dFT+c+2msYDGE6JEa85yp6b4I0PQp41wpdOjkMfqS+rPwvIpd/B8FAb9XBr6BlQW+h y3JNpzvQ7GvxoeKShSUDTMPFmloMbPA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1719926481; a=rsa-sha256; cv=none; b=EEgGfEySK+AOKa9Rbt/oSTzOBBWcf9KAlLRtEvEwlap9YN4ncad14UfzxgW9f9Tp8s+tsp fTvT3Cklev/vFRA8r9lRUFwgCBNFUhpmEag44QPRCaAU1la7/jIl6w4Fc3URy/3haBYobE N8LOJglO1BhYZjh07gc3lpmgMfphsnM= ARC-Authentication-Results: i=1; imf12.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=uPhJc6DX; spf=pass (imf12.hostedemail.com: domain of 35v6DZgoKCC8jZdcjLSXPORZZRWP.NZXWTYfi-XXVgLNV.ZcR@flex--yosryahmed.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=35v6DZgoKCC8jZdcjLSXPORZZRWP.NZXWTYfi-XXVgLNV.ZcR@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-643f57e2f0fso74350287b3.0 for ; Tue, 02 Jul 2024 06:21:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1719926503; x=1720531303; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=hhKXhYrzfxh/rcH5rhg00qdwvGaDRGv233TWfBtt8ow=; b=uPhJc6DXKXBt3JP2nPDYrsoMU9XUabsEVyLj2T8N1udJDhbxSUya6BDSvF6k1yHEU9 v2IbKxUmi27NDicjXsz1Ea83rZVKZDrggUnQ4D5WOXcXau9XhZ+JCTtLJxt1kOoD2dc/ hk/q3NuxAA/OpBHcAXRUaZXfjQHbxwp5boJWKNOift84cFu+OqxvFIWOiWUaf4ikEzgz PmhAommtdA3vlV8FLe2P1gw/kGzTSyU83NsDgLfosMXAMS4Hc6sDyQ+osOP5dKdIziuF 4VQwB00ub8VBBFbuakqmvLqOjsjlP3dN/OXqA+To43O2X8B61qD6vIGUR6nhhFaMwgDD ODEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719926503; x=1720531303; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=hhKXhYrzfxh/rcH5rhg00qdwvGaDRGv233TWfBtt8ow=; b=b7MnCtmkJyEvXrS0sGz3lwWZN+RUQ/u4gtR7oXSLicTOI9ay5h15eM9n3nJyyXJe32 YoslRykdo/yYw4OCVyGSzz/dpV4NWCfbxD1eeWvPH7nlyjAHY8j47JzL6cGWNjh+momP bNUNid5C0lX8f4FI+4dHozzMyAWxCgmhcCwSbwDpbLndqwTdXSh9gcJpJHKGZx+Nk48o AGZq0wvRiGAZs2PUufI3abMFgqGjLf7hZaacmuKR8eADrvCEL5iTu7P3Bnni552B6XfH f1wj8MkEwdQd6NKx+Sz7hsuVn3V46rP6G17GA2tScazDy+09vBFJ/MOPnXsXUgxjDJEa 4Bfg== X-Forwarded-Encrypted: i=1; AJvYcCWMpSnSvTbSb9yTW7XECOqMT5YGSIUQSzbV5J//ve8vhJ/a9+IX8QfhwXjb2NbbdaAe2CqLvWaPTHEpWoRTDKE2UjY= X-Gm-Message-State: AOJu0Yz8RPaPx5JWl/TY8HJ1j/Xk8oqwdRv7h3X49iZf5X37EUXA1jeo BbEVW2CVtlx7d8+1NHIApQtPkn3vtDJ3iaImaavIOSYJlOJK8zdghf4/Q7it+5MKuOLxT59uy88 pM3ydLRfQyel+dEJzXQ== X-Google-Smtp-Source: AGHT+IFhrR8/1AVaUeKAjimUNiNcEXyIPVmNICv9iqQp5yyXMQvYoOHL1JnwP0JxNLqOXlGHT/mwLjhpuU/mOvDg X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:29b4]) (user=yosryahmed job=sendgmr) by 2002:a0d:e646:0:b0:62f:22cd:7082 with SMTP id 00721157ae682-64c7685e929mr365947b3.5.1719926502763; Tue, 02 Jul 2024 06:21:42 -0700 (PDT) Date: Tue, 2 Jul 2024 13:21:36 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.45.2.803.g4e1b14247a-goog Message-ID: <20240702132139.3332013-1-yosryahmed@google.com> Subject: [RESEND PATCH v3 0/3] x86/mm: LAM fixups and cleanups From: Yosry Ahmed To: x86@kernel.org Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Andy Lutomirski , Peter Zijlstra , "Kirill A. Shutemov" , Rick Edgecombe , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yosry Ahmed X-Stat-Signature: tdfkjteay7uo3euw5rd49pbn57jqy4sj X-Rspamd-Queue-Id: 0901B40012 X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1719926503-464032 X-HE-Meta: U2FsdGVkX1931BReuphm93GzqW5Gf9OBHwvBazVVE2afxDDsNlpos5pNIglGHbjSMEPFxqXLKIUDmXuXqoiUTnWA9rdVJe68yBzBpYglXl29kBgxddMwL0udpinAGc7/U3QATdsf2waHwXEtuER2BcrnTxolGdltyFahPqs8O6l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1sHjX4HXBK9U21tk1s6arqC+R4OiSCI442NoJxzNozfs4YBgGaCBPYV0GBaxYA7l9mFNPujjAlcEbzwROLINR9UFQbhhTQYGLOt6CE5KyYC9gmcFJgBr32TftKqYJ+wwrU7GFPu8UkHPNQBbA40bd8rqlphM/d1ptaCaqsORKqt+U5E6ZRJTi0KAqUYEg7xJvvillvzqO4Pi6SrysDI1TknlDeqM7USMDvVcCkc3E62ayyI7crelo0dU/2Tl8k+1YmFzeYgQabYwgWK1kgXgEvdSzH1P0gKs/RTqOuWhpYxy0+LpDT2kVtN101jzsKqF0P+RWTcSBic0vQl8e1Ed7AhdH8QZhvk4JDphRdeHUEqL0U= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: This series has fixups and cleanups for LAM. Most importantly, patch 1 fixes a sycnhronization issue that may cause crashes of userspace applications. This is a resend of v3, rebased on top of v6.10-rc6. v3: https://lore.kernel.org/lkml/20240418012835.3360429-1-yosryahmed@google.com/ v2: https://lore.kernel.org/lkml/20240312155641.4003683-1-yosryahmed@google.com/ v1: https://lore.kernel.org/lkml/20240312035951.3535980-1-yosryahmed@google.com/ RFC: https://lore.kernel.org/lkml/20240307133916.3782068-1-yosryahmed@google.com/ Yosry Ahmed (3): x86/mm: Use IPIs to synchronize LAM enablement x86/mm: Fix LAM inconsistency during context switch x86/mm: Cleanup prctl_enable_tagged_addr() nr_bits error checking arch/x86/include/asm/mmu_context.h | 8 +++++++- arch/x86/include/asm/tlbflush.h | 9 ++++----- arch/x86/kernel/process_64.c | 25 ++++++++++++++++--------- arch/x86/mm/tlb.c | 15 ++++++++------- 4 files changed, 35 insertions(+), 22 deletions(-)