Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1452014rdd; Wed, 10 Jan 2024 22:23:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IHWqQIJVxN6JGOXJ/nMgMWl5XAY+r0NDXTqmju8rjmTyeEVAUyp82xHqGFgJxYiiCW0yZC8 X-Received: by 2002:a05:6a00:1916:b0:6da:6164:a1f3 with SMTP id y22-20020a056a00191600b006da6164a1f3mr893545pfi.58.1704954224668; Wed, 10 Jan 2024 22:23:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704954224; cv=none; d=google.com; s=arc-20160816; b=ZH0e3jr+8FfKYqE4kYW/ydw8wjaIy7M3Q9IjIrjqVzcgPzoTTt3/9hGfItmEZLnUFN k3ddVu8S+YZkibXMuc5nIJfbQjaW5dRChsTDCYaOLUMG1xK/dmsd5PtOTEcd4EDvTs0S VorKRv24Om6ZHXCazseV6le6YK8338/U+9YW5grF7JrZ8R1FE63XBhOH+U0DA7ditLcG 9hJaEupeibRJLZObfEj85CVtXAOxUcMYl133WhIoznxyEUCNJ0paS4LJ5KKUPdflP1Gn ExlyfmDRCS1raQNnRmRpanfthfyM2TL4NQVfa7FdWUT6OCQgcfjYwxytJ4cMB1o3YDKs WYQw== ARC-Message-Signature: i=1; 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=qkutryktk1+eA6li8Kr0a/P8xPDRQ0wHxGCKWFfNW0w=; b=CFQczhV+adGn5H3hiLHb9+NSG1J73eoNQGXXe92lJ0rHyWd1DO2wtnRmMHIWNlTBKF Tft6R+EO3mE5jgKLecttxF/H2OTdnkduScYgwuKacmHMg4gurFRXvvlp0C4fPe6/704V kgbDADbGlPY6jJDGB6zpSU3lALRd4+6aJdov3HKSM8QdgJ2gDYAd8eKAH21SRQHig7zi IreVUTC2SFldsseiVKkIwEilp3XUSGqA1l9Ksa903IH8wLrDF21ASTfVG6QoUhbmQhsb lY2FgBmmRRoty+II2lasRQIhjCFAa6ntrP3RPXj0dQOMyEtkU2P8CepQ4rbZYRZpw2Y3 /Ecw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-23087-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23087-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id y63-20020a638a42000000b005cddb743bc7si433788pgd.709.2024.01.10.22.23.44 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 22:23:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-23087-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; spf=pass (google.com: domain of linux-kernel+bounces-23087-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-23087-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 52B30286197 for ; Thu, 11 Jan 2024 06:23:44 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 21FE8748A; Thu, 11 Jan 2024 06:23:33 +0000 (UTC) Received: from invmail4.hynix.com (exvmail4.hynix.com [166.125.252.92]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B68CC6AA6 for ; Thu, 11 Jan 2024 06:23:30 +0000 (UTC) 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-d6dff70000001748-de-659f85c70830 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, xhao@linux.alibaba.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 Subject: [v5 1/7] x86/tlb: Add APIs manipulating tlb batch's arch data Date: Thu, 11 Jan 2024 15:07:51 +0900 Message-Id: <20240111060757.13563-2-byungchul@sk.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240111060757.13563-1-byungchul@sk.com> References: <20240111060757.13563-1-byungchul@sk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrELMWRmVeSWpSXmKPExsXC9ZZnke6J1vmpBg+usFrMWb+GzeLzhn9s Fi82tDNafF3/i9ni6ac+FovLu+awWdxb85/V4vyutawWO5buY7K4dGABk8X1XQ8ZLY73HmCy 2LxpKrPF7x9AdXOmWFmcnDWZxUHA43trH4vHgk2lHptXaHks3vOSyWPTqk42j02fJrF7vDt3 jt3jxIzfLB47H1p6zDsZ6PF+31U2j62/7Dw+b5LzeDf/LVsAXxSXTUpqTmZZapG+XQJXxu3b L5kKVvFVLPnRztbAOI2ni5GTQ0LARGLby5dMXYwcYPa8TZkgYTYBdYkbN34yg9giAmYSB1v/ sHcxcnEwCzxgkpj7dgUjSEJYwE2i/8M3JhCbRUBVYtHNTlYQm1fAVOLdzR5WiPnyEqs3HAAb xAk06MLhWYwgu4SAah611UGUfGeTeLK0FMKWlDi44gbLBEbeBYwMqxiFMvPKchMzc0z0Mirz Miv0kvNzNzECQ35Z7Z/oHYyfLgQfYhTgYFTi4X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CRPIrmf85ey7jNVWdkrNucvb8G2Gl D668dZ3esEOJpTgj0VCLuag4EQDnu2KHXQIAAA== 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