From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from va-1-115.ptr.blmpb.com (va-1-115.ptr.blmpb.com [209.127.230.115]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5FA7429B781 for ; Wed, 12 Aug 2026 03:56:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.127.230.115 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786506999; cv=none; b=FdHnDi5r5q23wNkhBVhGkm+fvg91FECyI4iu8uq97dTJ6Nvkmd4Bk+gZV/ZqE1WUU0jDSWyTp6Wm5NITpYw9SampgnukBRZANvNlAO3UnjBRbTjxEKwbsg4iHdnwf1DZZBFbTnmrzYjA+Nb5niU0WBzgcxGxkYQJj2Mh3Ayu27A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786506999; c=relaxed/simple; bh=94jH1+OtcUw1+pZ5cZ2ly4auDdDasdbBbh/SBjBiRSM=; h=From:To:Date:Message-Id:Content-Type:References:Cc:Subject: Mime-Version:In-Reply-To; b=ZXDNUw4jnIMRQGthBwex6/6taHlwzid8xUJ66L341f9lXEGhtotdfdRMWlIUIssTPDkmn1bVY5L5YJGTMfT6J3swnVnKRJNGOYiLT3HrWVc/n2AkbH+YkhhQWViCSAZ4pibAsBkhIXKCq3DLhHcH7zF1UOuXeVSrjWIeyEHOy/s= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com; spf=pass smtp.mailfrom=bytedance.com; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b=eGXNmgWR; arc=none smtp.client-ip=209.127.230.115 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=bytedance.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bytedance.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bytedance.com header.i=@bytedance.com header.b="eGXNmgWR" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=2212171451; d=bytedance.com; t=1786506985; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=Zy6yxar6rjOPuNUfoWerY4SUxt56O2FOY3yeozfmKbI=; b=eGXNmgWRqFMFe8GhBsFLriB9szPZQtNg015AdbsQ5Zv3pqPmUcQ1b7Bmd8fC/nC4cNhPvE 6CZ3Lpaehtxz897exToVjwfCpifzmRC4BdrJ/VDVAdrCiZtIp+xDA/N5b/rZbBUD809s6B I+JImespHXWC1nupPpXvZrPs+v6XlAalTtKDWPDBwtdtSPHe6uzQkvXyGZi/MALHaIK3lT LKyRAagxaQYgRGEJu93/BnwTFwqSAGxD9hqc0V+jOOasGsUf5iaa36HZxcntW3qmpJ+0aI pt12PziXgTNeF/S4Q8Sazfi/kUfPuItuHLNzGSluuSLXfXUkRsbIJLYVKpebUw== From: "Chuyi Zhou" X-Lms-Return-Path: Content-Transfer-Encoding: 7bit X-Original-From: Chuyi Zhou To: "Borislav Petkov" Date: Wed, 12 Aug 2026 11:56:03 +0800 Message-Id: <95e2448b-09cd-479b-aa9c-29548f9ed0d9@bytedance.com> Content-Type: text/plain; charset=UTF-8 References: <20260709122933.4021501-1-zhouchuyi@bytedance.com> <20260723192657.GBamJrAcb_TCH5Ubog@fat_crate.local> Cc: , , , , , , , , , , , , , Subject: Re: [PATCH v10 00/14] Allow preemption during IPI completion waiting to improve real-time performance Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 User-Agent: Mozilla Thunderbird In-Reply-To: <20260723192657.GBamJrAcb_TCH5Ubog@fat_crate.local> On 2026-07-24 3:26 a.m., Borislav Petkov wrote: > On Thu, Jul 09, 2026 at 08:29:19PM +0800, Chuyi Zhou wrote: >> In our production environments, latency-sensitive workloads (DPDK) are >> configured with the highest priority to preempt lower-priority tasks at any >> time. We discovered that DPDK's wake-up latency is primarily caused by the >> current CPU having preemption disabled. Therefore, we collected the maximum >> preemption disabled events within every 30-second interval and then >> calculated the P50/P99 of these max preemption disabled events: > > Out of curiosity, can you run your workloads on AMD Zen3 and newer which have > TLBI support (this does away with the TLB flush IPIs). Do you see any > improvement there? > > Thx. > Hi Boris, Thanks! I think this can be tested without setting up DPDK. DPDK was only the latency-sensitive workload which exposed the problem in our production environment. The direct effect of this series is to shorten the preemption-disabled section around a synchronous TLB-shootdown IPI. A more direct test would therefore be to generate TLB flushes and compare the maximum preempt-off latency between the baseline and patched kernels. I have not tested the following setup on INVLPGB-capable hardware myself. I have only checked it against the kernel and stress-ng code, so please treat this as a suggested starting point rather than a known-good reproducer. The workload or tracing may need some adjustment if it does not hit the expected paths. Two stress-ng stressors appear useful for separating the INVLPGB and IPI cases. 1. INVLPGB/global-ASID path A recent stress-ng, starting with v0.21.01, has the tlb-numa stressor: stress-ng --tlb-numa 1 --timeout 5m --metrics-brief One stressor instance runs a main thread and three pthreads sharing the same mm. The threads move between CPUs and repeatedly perform mmap(), munmap(), madvise(), and mbind() operations. If the same mm is observed active on at least four CPUs simultaneously, the kernel should initially use the IPI path, assign a global ASID, and then switch to INVLPGB broadcast invalidation. It would be better to let this workload warm up before starting the trace. Once it reaches the global-ASID steady state, I would expect little or no difference between the baseline and patched kernels, since there is no remote IPI completion wait. The INVLPGB/TLBSYNC sequence itself still has to remain within the CPU-pinned section. 2. IPI fallback path The older tlb-shootdown stressor can be used separately: stress-ng --tlb-shootdown 1 --timeout 5m --metrics-brief This stressor forks several processes. Each process has a separate mm and periodically migrates between CPUs while repeatedly executing mprotect() and madvise(). Since each mm is normally active on only one CPU at a time, it should not acquire a global ASID. The mprotect()-generated flushes should therefore continue to use the ordinary IPI path, even when INVLPGB is available. This is the case where the reduction in the preemption-disabled section should be visible. With CONFIG_PREEMPT_TRACER=y, the test can simply compare the preemption-disabled intervals attributed to the TLB flush paths on the baseline and patched kernels. For the IPI case, the baseline interval should include the remote IPI completion wait in csd_lock_wait(), while the patched kernel should re-enable preemption before that wait.