Received: by 2002:a05:7412:7c14:b0:fa:6e18:a558 with SMTP id ii20csp50120rdb; Sun, 21 Jan 2024 17:01:21 -0800 (PST) X-Google-Smtp-Source: AGHT+IE++AszfMOvxAdmEEV57UrSalQyo8cdGlPcX3OWzPPzP9kVlmZcSw1RKGxiNOpTX7weO6EV X-Received: by 2002:a17:906:fd8c:b0:a2c:864b:1112 with SMTP id xa12-20020a170906fd8c00b00a2c864b1112mr2315956ejb.27.1705885281069; Sun, 21 Jan 2024 17:01:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705885281; cv=pass; d=google.com; s=arc-20160816; b=RV9ZXVrqEbt/42bbOE4aDialPmEdD+t89+3WzkX+qPEraZ+c+0Scx4ByLprqihXsEv Sudz01zOb5Qg4NPrp3siyQp6FDmX7naF600VHOtRpBbWumE44elMwep4+ctCDzQUr29W lMhgaaJyT/efAG4uR5KzoWhWrUnt8YdcdzTDbOdUwVHxmyfFD06LVmAqHr2vW0TBFDUS NCDFN2ye5wC11rw2Av1K5xbfdfBQjDR4s6Ugsd1rSmo52ERbJb9ShMILUbDh9NP79JV5 UM9ckcu8XoG7OuD7uWHT/mfLFc+dA+1/V3q70fT5iRmaDW9OIOeyfwFSklW2FhvxDxkC k1gQ== 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=I/fJb8ryqmmGEnsMy9AhDuMN2ego/v5YAM2Gbv30rAg=; b=aPmP4ML/IEqkRboYHJ05xscxb5+l6XKHTakvUKNfenW5IJJaypSJUgGWDm4dqDZFnY tLWmGyg7WFblalc5cbrAtK/sgj4o1i75zocb/EDidMSwaprgSWplW82VUEI8/mHkkbrn X1pMrYT0wUvLOCN/287FBlRO+sDPvWNEK+N4uuTlQ7fJOlV8o2sHRP1gwYaBAWnB7thr hiqYy3pMAuvTvdurHnEqZ/9Ww0A6B8ZWIwtYuKdJI1zkFso9kq9oTJxpn/3BoC10nn0S HKV0ZniFsV9woNydIckT3Ie8gzWgGwCuZLKawFx5KDjhcUFwp894q5tH2Q3IcnVHAp2T snHw== 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-32245-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32245-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id o19-20020a17090611d300b00a2697f77293si10077025eja.232.2024.01.21.17.01.21 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Jan 2024 17:01:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-32245-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=sk.com); spf=pass (google.com: domain of linux-kernel+bounces-32245-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-32245-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 am.mirrors.kernel.org (Postfix) with ESMTPS id D00E81F22B81 for ; Mon, 22 Jan 2024 01:01:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D793915C8; Mon, 22 Jan 2024 01:01:04 +0000 (UTC) Received: from invmail4.hynix.com (exvmail4.hynix.com [166.125.252.92]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A3D23364 for ; Mon, 22 Jan 2024 01:00:58 +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=1705885264; cv=none; b=Wkfb2tGRdn3aleP/ia+qLoNAVSsBQ+eVdAKoLlk0FZh1jPT5iEpNfF5mSJPO1mqdCSec19pVmYYEqmNFXKrO1yOqRrkQ1S5Mt58fz1snriJAgEI0JIwWouGndPxBEJkfCNHNZvnCFwC+G2lI/rwHW9wLLtqGmXLPhbsOl2lzqno= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705885264; c=relaxed/simple; bh=jCdznYeqTxnAdPqUo3goftYDv+lHb7g10nhlhcikrfU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=LZx/NdAz0hVTidEtgxSo6uf3yABF+7DlJBlGLsoqej40HvxHDZZy4tm7oV0bZjGtLjKTaLayy+kA24ck58V17D1QkT/WrnDJ3G71UQO7nwRiJNpqpzy+9dBo91Zj6Agzs9fSdN0qn/dVWJXdGW8C1//qYAYHVKBhFhRMwNT4chs= 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-6d-65adbe43e950 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: [PATCH v7 1/8] x86/tlb: Add APIs manipulating tlb batch's arch data Date: Mon, 22 Jan 2024 10:00:33 +0900 Message-Id: <20240122010040.74346-2-byungchul@sk.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20240122010040.74346-1-byungchul@sk.com> References: <20240122010040.74346-1-byungchul@sk.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrPLMWRmVeSWpSXmKPExsXC9ZZnka7zvrWpBgunSVnMWb+GzeLzhn9s Fi82tDNafF3/i9ni6ac+FovLu+awWdxb85/V4vyutawWO5buY7K4dGABk8X1XQ8ZLY73HmCy mH/vM5vF5k1TmS2OT5nKaPH7B1DHyVmTWRwEPb639rF47Jx1l91jwaZSj80rtDwW73nJ5LFp VSebx6ZPk9g93p07x+5xYsZvFo95JwM93u+7yuax9ZedR+PUa2wenzfJebyb/5YtgD+KyyYl NSezLLVI3y6BK+P27ZdMBav4Kpb8aGdrYJzG08XIwSEhYCJxZXNgFyMnmPnnxXt2EJtNQF3i xo2fzCC2iICZxMHWP0BxLg5mgY9MEqu/d7CAJIQFfCQmHm5mApnDIqAq8XmTE0iYV8BU4uDG 14wQM+UlVm84ADaHE2jOlF9dTCC2EFDN3A87GUFmSgi0s0ts7p3PBtEgKXFwxQ2WCYy8CxgZ VjEKZeaV5SZm5pjoZVTmZVboJefnbmIERsOy2j/ROxg/XQg+xCjAwajEw+vAvjZViDWxrLgy 9xCjBAezkggvv+qqVCHelMTKqtSi/Pii0pzU4kOM0hwsSuK8Rt/KU4QE0hNLUrNTUwtSi2Cy TBycUg2Mq44Xf1h3iJtfq3Lpgi+TuS5bvTrVez/0xVxXZn9fs1Mzzv/aUrjt2yStn3X5orzP BL0lxf6aXrm8XVrZQ8pIRqBwm+OlZKtD53yk1Ix05re7vZn+I3FPXNqsac+Vnlgmphrk6C4L te098muTMteG06GvGC9cSrfviLp4uVT27qzDZktdhJ8cU2Ipzkg01GIuKk4EAPEP+0yCAgAA X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrOLMWRmVeSWpSXmKPExsXC5WfdrOu8b22qwckZ/BZz1q9hs/i84R+b xYsN7YwWX9f/YrZ4+qmPxeLw3JOsFpd3zWGzuLfmP6vF+V1rWS12LN3HZHHpwAImi+u7HjJa HO89wGQx/95nNovNm6YyWxyfMpXR4vcPoI6TsyazOAh5fG/tY/HYOesuu8eCTaUem1doeSze 85LJY9OqTjaPTZ8msXu8O3eO3ePEjN8sHvNOBnq833eVzWPxiw9MHlt/2Xk0Tr3G5vF5k5zH u/lv2QIEorhsUlJzMstSi/TtErgybt9+yVSwiq9iyY92tgbGaTxdjJwcEgImEn9evGcHsdkE 1CVu3PjJDGKLCJhJHGz9AxTn4mAW+Mgksfp7BwtIQljAR2Li4WamLkYODhYBVYnPm5xAwrwC phIHN75mhJgpL7F6wwGwOZxAc6b86mICsYWAauZ+2Mk4gZFrASPDKkaRzLyy3MTMHFO94uyM yrzMCr3k/NxNjMDgXlb7Z+IOxi+X3Q8xCnAwKvHwOrCvTRViTSwrrsw9xCjBwawkwsuvuipV iDclsbIqtSg/vqg0J7X4EKM0B4uSOK9XeGqCkEB6YklqdmpqQWoRTJaJg1OqgTHftnX2xfx3 FenT6ut/s2VKcJ9/P0X5S+rcc488mncab3jINtmTL5bhx+flJ8PMprJJv/2+6e6f40XNjtwH TiRp7hY0PyrlH2Vb6lzZ8G+n87uG50WGi89xLkqT+PEk5VbsYR2ObMHTm12uP57CJz5R+Hp0 X98Bu3C/2eb+b7/P+vq2x3/ltMVKLMUZiYZazEXFiQAKYOYmagIAAA== 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