Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp83325rdb; Wed, 7 Feb 2024 22:37:14 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWnPTlxLzUFdspXaKG3qwwmA0JJwPULDchH9TH5VECmTR+Vl1IfvpEoomPnew09lwLvFtMUIbTDQabzOgZrPm3Td+Ix0U4ZB1j3+LEDTw== X-Google-Smtp-Source: AGHT+IFf6KTEipEXW6iwR8Q4P/R6W7Ded1hSw3OUXFMKSzayLCb1RzhCs+Q9V96Lqq7enXJ6r+wG X-Received: by 2002:a05:6870:9128:b0:218:f68f:db50 with SMTP id o40-20020a056870912800b00218f68fdb50mr8947968oae.10.1707374234058; Wed, 07 Feb 2024 22:37:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707374234; cv=pass; d=google.com; s=arc-20160816; b=AIp0QbR3eotDdXlhPrig3TQkam1soWFDmX/t+obobyXGv9NEoGnE0ZooEnrhIbNRES 2UjqAAH54uAKFDLUz/QpK0Ht6NYZa3qWSpUCutQnN5+YXAgL2GUEoDDt6RvdMFHSi9NE loFFt14WPQD3sHZJSeIxsnaaIo0cxiJ0/8T+MTzBIdAIBqGPwRYS8M1Oaf/ENcVbUQ/p 7Tn5000rw+s2Ksa7HV6UGpDb5mVEZJjauu9Iok1gnO9EItOqlYHHsmSRQapHUotWwptk iEJPTwLWpxmy0m+KkamkBOmbFVgR9O2EmQ3mG8JpDigPMXGwmGaA7ozsW8vVLOXa5uMj TzHg== 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:references :in-reply-to:message-id:date:subject:cc:to:from; bh=eRD1/8o+qtEOTAKMY7ucioDJJtMI3+WpTL+ASvHX4To=; fh=WfEq7tgyII2/LpbSWU8bh72SOh1qKLenXnn+zXx0oTc=; b=LZYduN8RQ+g6FzmxLarAE/9gleQfR/00jlwE70pXvA6maJ5ba7ywvqoxoDlM7EK9JE iEQLL/05CkX4lvLQVBw9F0D/tyV6fQtWErpq7mHUOhec7agYBQ6u+2KPnd1vLTu99vXq 4f35HUGjJFbH+FXuSKSHbSZLlGUiEt582QPmbtBDOaJ4vUOIU5yI9wmnQURYWdPiYuXs EjhDuOBJtvZafQL/pgTOkiAyfj8vqt3MRHw5wHzpbYTpFa8FcLPqu/CBNe+ov1T69l5W zp3sYNMX/t27T6TK1cFc4adXtC7WwyhJCx5Te6bRPjG61Xw6oteeDMm/V2aNhJRixTQF 1XfA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=sk.com); spf=pass (google.com: domain of linux-kernel+bounces-57513-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57513-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=2; AJvYcCVdFbqqxCpZiWnOnBidFhH7nUrGhq5EMOH1DJjVuoCMayEXjtvZFZe/SFWieO4kvimHdzNEYdWLvPK0CxB5kAfPQfr3H9ii20ee1CbsiQ== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id t28-20020a63b25c000000b005dc1546dcdbsi3242451pgo.158.2024.02.07.22.37.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Feb 2024 22:37:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-57513-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sk.com); spf=pass (google.com: domain of linux-kernel+bounces-57513-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-57513-linux.lists.archive=gmail.com@vger.kernel.org" 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 19A7A286EB3 for ; Thu, 8 Feb 2024 06:26:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D42467E68; Thu, 8 Feb 2024 06:26:26 +0000 (UTC) Received: from invmail4.hynix.com (exvmail4.hynix.com [166.125.252.92]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 913A067C6D for ; Thu, 8 Feb 2024 06:26:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=166.125.252.92 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707373586; cv=none; b=q+EPlkLoeEaI3tzKFfcRtjmUKQNM+YlJeqk2jgeEIto4AaB/r3x1FtCz4SS3t5xunUljnju4mTXrpgH3ZUoUbCJezsImgss6Eri9/kasB0NY6BDQZLOQ4sEQlRMkCBezbgZYfJQtShsTpgQRmy0x5SGWMzuJMjXzJ4UvPSVCABo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707373586; c=relaxed/simple; bh=jCdznYeqTxnAdPqUo3goftYDv+lHb7g10nhlhcikrfU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=AXSOLMicz94VH+fi+3aRA3f7GxyJSgw6R2KgZdXewP5z/1U2Fmm23MWzUDQJUF9X6CK+edAphJkZOj/JKJ0dJ4wUxypLcYL+LbtXPBur6rHWFS5AjdCDSRqJQw2PjPu8CHMJWiDQyY6KtrX3zdpZl/TnwO29Z27J9DKOZeeHaTk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com; spf=pass smtp.mailfrom=sk.com; arc=none smtp.client-ip=166.125.252.92 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sk.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sk.com X-AuditID: a67dfc5b-d85ff70000001748-74-65c4740a3ee5 From: Byungchul Park To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: kernel_team@skhynix.com, akpm@linux-foundation.org, ying.huang@intel.com, namit@vmware.com, vernhao@tencent.com, mgorman@techsingularity.net, hughd@google.com, willy@infradead.org, david@redhat.com, peterz@infradead.org, luto@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, rjgolo@gmail.com Subject: [RESEND PATCH v7 1/8] x86/tlb: Add APIs manipulating tlb batch's arch data Date: Thu, 8 Feb 2024 15:26:01 +0900 Message-Id: <20240208062608.44351-2-byungchul@sk.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240208062608.44351-1-byungchul@sk.com> References: <20240208062608.44351-1-byungchul@sk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrILMWRmVeSWpSXmKPExsXC9ZZnoS53yZFUg23r2CzmrF/DZvF5wz82 ixcb2hktvq7/xWzx9FMfi8XlXXPYLO6t+c9qcX7XWlaLHUv3MVlcOrCAyeL6roeMFsd7DzBZ zL/3mc1i86apzBbHp0xltPj9A6jj5KzJLA6CHt9b+1g8ds66y+6xYFOpx+YVWh6L97xk8ti0 qpPNY9OnSewe786dY/c4MeM3i8e8k4Ee7/ddZfPY+svOo3HqNTaPz5vkPN7Nf8sWwB/FZZOS mpNZllqkb5fAlXH79kumglV8FUt+tLM1ME7j6WLk5JAQMJGYuHUdM4y97csFRhCbTUBd4saN n2BxEQEziYOtf9i7GLk4mAU+Mkms/t7BApIQFgiWuL7qExuIzSKgKrF5zx8mEJtXwFRi55T9 LBBD5SVWbzgANogTaNDObadYQWwhoJoXsyezgQyVEGhnl1g57wYjRIOkxMEVN1gmMPIuYGRY xSiUmVeWm5iZY6KXU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wHrVR2o93nc25UhOXFWtsKj6z8FJEcGTbu70XDtJwMpI6+aOxQ2/31o+f/LgxWvW h1u+bn6iONPhb9/6rc92GdWqnJifrsRSnJFoqMVcVJwIAFYAZeNrAgAA X-CFilter-Loop: Reflected Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: This is a preparation for migrc mechanism that needs to recognize read-only TLB entries during batched TLB flush by separating tlb batch's arch data into two, one is for read-only entries and the other is for writable ones, and merging those two when needed. Migrc also needs to optimize CPUs to flush by clearing ones that have already performed TLB flush needed. To support it, added APIs manipulating arch data for x86. Signed-off-by: Byungchul Park --- arch/x86/include/asm/tlbflush.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/x86/include/asm/tlbflush.h b/arch/x86/include/asm/tlbflush.h index 25726893c6f4..fa7e16dbeb44 100644 --- a/arch/x86/include/asm/tlbflush.h +++ b/arch/x86/include/asm/tlbflush.h @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -293,6 +294,23 @@ static inline void arch_flush_tlb_batched_pending(struct mm_struct *mm) extern void arch_tlbbatch_flush(struct arch_tlbflush_unmap_batch *batch); +static inline void arch_tlbbatch_clear(struct arch_tlbflush_unmap_batch *batch) +{ + cpumask_clear(&batch->cpumask); +} + +static inline void arch_tlbbatch_fold(struct arch_tlbflush_unmap_batch *bdst, + struct arch_tlbflush_unmap_batch *bsrc) +{ + cpumask_or(&bdst->cpumask, &bdst->cpumask, &bsrc->cpumask); +} + +static inline bool arch_tlbbatch_done(struct arch_tlbflush_unmap_batch *bdst, + struct arch_tlbflush_unmap_batch *bsrc) +{ + return cpumask_andnot(&bdst->cpumask, &bdst->cpumask, &bsrc->cpumask); +} + static inline bool pte_flags_need_flush(unsigned long oldflags, unsigned long newflags, bool ignore_access) -- 2.17.1