From patchwork Thu Mar 7 13:39:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13585598 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 912B7C54E49 for ; Thu, 7 Mar 2024 13:39:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E87BE6B017E; Thu, 7 Mar 2024 08:39:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E377E6B017F; Thu, 7 Mar 2024 08:39:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CFF936B0180; Thu, 7 Mar 2024 08:39:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id BC2916B017E for ; Thu, 7 Mar 2024 08:39:21 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 7BF41161065 for ; Thu, 7 Mar 2024 13:39:21 +0000 (UTC) X-FDA: 81870349722.12.6AAF2D5 Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) by imf06.hostedemail.com (Postfix) with ESMTP id B176518000B for ; Thu, 7 Mar 2024 13:39:19 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=L7QSX3eo; spf=pass (imf06.hostedemail.com: domain of 3hsPpZQoKCOkjZdcjLSXPORZZRWP.NZXWTYfi-XXVgLNV.ZcR@flex--yosryahmed.bounces.google.com designates 209.85.210.202 as permitted sender) smtp.mailfrom=3hsPpZQoKCOkjZdcjLSXPORZZRWP.NZXWTYfi-XXVgLNV.ZcR@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709818759; a=rsa-sha256; cv=none; b=a0P5+3nTMJVD7/tr3jJcB133VUrrhUQve4v5YTV41kbuYXHJFTOOziKIwlLYCjUkFZFtK9 S8d/x1CvtWbjWnBwUJDVtK0aBOaH72/sn+U/76Jv0+MU8LHI5JOUyfI+5UEr55Um8hZJ10 lW597oVTte4U5VqFx6Qw6AC9YwcpvUI= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=L7QSX3eo; spf=pass (imf06.hostedemail.com: domain of 3hsPpZQoKCOkjZdcjLSXPORZZRWP.NZXWTYfi-XXVgLNV.ZcR@flex--yosryahmed.bounces.google.com designates 209.85.210.202 as permitted sender) smtp.mailfrom=3hsPpZQoKCOkjZdcjLSXPORZZRWP.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=1709818759; 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=E/SwFKeyu0Cz8CMZ9BY5anwy2e+f+qNiUH5wmPNWioQ=; b=0hHrko/z5O9hW4Y4UFgxI7GCoTKtmOu9NXvFVzgla23WxlplzC3mOtrA3ME2V2AyFED3pC x/iW8ncGv6vkmd9Zhlb18870pjD19Ubi8SzQppAhUTHqqiawlWfrtihwPZS2E7DG/ndgLn rsX0eIJgWrha8l08k5OT+q0sBL7FVHs= Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-6e5a145ab89so792488b3a.0 for ; Thu, 07 Mar 2024 05:39:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709818758; x=1710423558; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=E/SwFKeyu0Cz8CMZ9BY5anwy2e+f+qNiUH5wmPNWioQ=; b=L7QSX3eongC3gIu8veD/vR8iwK5apVktYWF247ZtJbYvPoQ7xJHX8wLVqPvfBI3ke9 Lh1JL3wPG589WmK7etSS0iJgNjFsvN30ebw09FtLsYbxqOKAYEExEVvRw6CaYX7EnQ/3 kswrdJciCcyiYPPYDgV5jzLeMy6abF/u1BY3rAXrmwVm+eV/OFtmNv7rqX/xxuu3qerD WTS0pOGZ1R3LR/kgUrbx9m+hhAvaan6ptJNu8ZvzTlLQUGkEG2AAH7vAQcjNxgvt3iJz JAhUPcF2pQrJqFDMhPgMVvybDE+gje9GShU6gx7xoC2QB5YjfhpQ+KqJypOvjOcQdBJx JEIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709818758; x=1710423558; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=E/SwFKeyu0Cz8CMZ9BY5anwy2e+f+qNiUH5wmPNWioQ=; b=b/B8ChpTvGDgKifT0TgvBzyrd7QAoH4yLJgJhdxIi88bJlcwB6BpQ8Wu6HzERnZzt9 ydWPt94u3ML/pTd+VNTu0dv9IUiqUxuWRcQTUzLqfydC09hmHGVJBcXIZkfNsH+dfQEe H+swNejA4yu8doTmyCDUi87p2t90LTDN3mbAHazW/MC8/sIk4TPv5LnNFV0pFtemPJRu WNFcyPJj/QnVRNR47Ju9J5MDXPPtsMpGHDUY0yz+3aoxfoP25E+qrdD1iW4G26VJOY7x 6Z6/GgIu2/566T6FjeQGvd6wOQCLw62MW0dAHeGGRQz+PjYOmi2/Ebec7ocihWZAUEQm 3B4w== X-Forwarded-Encrypted: i=1; AJvYcCXuWseLVequ4hDbXA7dvYCGcG6HRnaS7IZwFiYSWMxVbTt5IYQ5Upml2etbaYa9RkEn6mVJIrG/TafZt7ysUYivIEg= X-Gm-Message-State: AOJu0Ywzy/tPpsOGxL6lqgJTx6UZMEk/lPkxoYzEPxE3UugT4w4uPD0i /oaO5R38nLIyNX91HBg/2jRf/iYFQNbdJPl3xvhek9sAelJPjkZCd2xcNIZluIc8o0EYjJBgQ/J WgBIVG+7e+aOMJjo2sA== X-Google-Smtp-Source: AGHT+IHz32782uRcDUcjLPEeb4P9whM7yS0F1jXCrHQfOc8Iv8MUgbMLaj0L1l7I93tNctD9q6p/q1YyXxJnzp/O X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:29b4]) (user=yosryahmed job=sendgmr) by 2002:a05:6a00:1796:b0:6e6:4946:93e3 with SMTP id s22-20020a056a00179600b006e6494693e3mr154496pfg.3.1709818758430; Thu, 07 Mar 2024 05:39:18 -0800 (PST) Date: Thu, 7 Mar 2024 13:39:13 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240307133916.3782068-1-yosryahmed@google.com> Subject: [RFC PATCH 0/3] x86/mm: LAM fixups and cleanups From: Yosry Ahmed To: Andrew Morton Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , Peter Zijlstra , Andy Lutomirski , "Kirill A. Shutemov" , x86@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yosry Ahmed X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: B176518000B X-Stat-Signature: sh6spzah4147s3r9m6sqjqs637wt1hs5 X-Rspam-User: X-HE-Tag: 1709818759-834750 X-HE-Meta: U2FsdGVkX190U1n3mZPQ6FUJ3J87EzUuH4PjZvV0brgARCfcm76d8jfMKLxrVGSiuL3R5j3nwO0MzQGUelJqFIA780i0p5ZYac3OGXApgTA8wZYoZ/qrhB1wKvVvudQ2O3f7cdvi36vQYkruuyDfGFS1uNeCkQSOg+r62Q9Qw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sHPJBUIXgTi3AfG+WcziVZ6jFLLu9SFFlZzI83F2A4SuKy560oxlqQrKCls0gwt0fAWyVhxJrL9rbz1hYgYQaIXoIPHoVXSFC375MXz7aiwYlLQEdLdjVJk++ME+cxErGlIsgZM/uvwnvXNpLuPPgRCcQzC3R1V4xr8twmhKxSU+kK2TU06zdkAQdA9fLcM6i+wefHd3b4ANJJP379zr+I99W3LUpELIRV2yIlK+9gl3wOVxBBOjuniDxDuuDQQbOarCwloh3p9hy69yt9RG1VuvjRJZJydM49eWKAFp1NnmpAFRqRtxyGtYWp4Om3KzKvje2Jpp25HJlT65JzcIH609mLO3WvYH4qcHqG7PXsZXsauzbYuiscpTrkUcV9uESTMReFFSRh4= 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 a few fixups and cleanups for LAM code noticed through code inspection. They are marked as RFC because I am not very familiar with this code so I may have gotten something (or all of it) wrong. Yosry Ahmed (3): x86/mm: fix LAM cr3 mask inconsistency during context switch x86/mm: make sure LAM is up-to-date during context switching x86/mm: cleanup prctl_enable_tagged_addr() nr_bits error checking arch/x86/include/asm/tlbflush.h | 11 ++++-- arch/x86/kernel/process_64.c | 10 ++--- arch/x86/mm/tlb.c | 67 +++++++++++++++++++-------------- 3 files changed, 48 insertions(+), 40 deletions(-)