Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp913684rdd; Wed, 10 Jan 2024 03:30:01 -0800 (PST) X-Google-Smtp-Source: AGHT+IHeeGtf5jJBwtVr+EtkuwAhq16YXSrEXsXYU7PBvanHk68pEAKRsgyYBMrOQKg1JHNPPZSk X-Received: by 2002:a17:90b:955:b0:28c:fec9:f205 with SMTP id dw21-20020a17090b095500b0028cfec9f205mr457916pjb.29.1704886201099; Wed, 10 Jan 2024 03:30:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704886201; cv=none; d=google.com; s=arc-20160816; b=SOG5XF8rQaTI4ZFrLNo2CIK9hDmx0u35CwtpzCy6FP3SO6bWenbe5Xu2pwwhi95CMi qz/wFflvAy2mjjE5pEHWsedotQjsT5EwfUYGXtMIqmAON38QIa3ABXqmEroTZzeci/C1 OmK9C27qrY2N/JiQCyRm+RqkYp+klvCRz54D/vquPKsW1zGpd9A6lfF/VU/E2I9LjuYx 0Vowju3oH0hQ1TGb62/m5E4BF7HBKW6ajYD7BkOmCWBzwVe7T2by672hmuJ6afnFsZes DjdDXqXY+a9EA40CUSbHxcIA+qsJDbhaIGoMjj37emdPiZb+mV+Zg95V96Nlcf4c3WI8 P5fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=subject:cc:to:from:date:references:in-reply-to:message-id :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:feedback-id:dkim-signature:dkim-signature; bh=bFVuHUCmJxRAxC1zh4/opM0gyA5+TjTOo7qCFS2FRg8=; fh=18xtKyXRidiJYUUCKaJ9ib0uR0uTBewkr+82+UvKHvs=; b=y+bmVJu6eQLeTEz+hXtOifyHg6Zyxxk/8Kh0ldzNuopqLlpZu55bw670e1D1f2kAjG 8uQ2hFVqwEuTYAB40ixXYeEEZ6sMpz3UmcfoqjyFtA1VOxDjZPDLZ3JtK5z5bZ9JptLY vfvFBceyR01q5zjx8Aagx0jdLQ/kfYsS0Hn0EWupaNocbVs232nGiPlJhKVUpYCh/IIy PA8d+cLiZRDqEXwaeTSqneIRtT0X10lu17xK4ueG5bnrc5kJrgeKTVSk54pT2Dgx51wr y2tBfi0amWBJtoGbDFoZ6AgQNFcqIWZtunBStIyjlKsRIoxCxDF34V7gnVnlRv80FmNz soQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@arndb.de header.s=fm2 header.b=GpMpkBqF; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=lpMQg2JN; spf=pass (google.com: domain of linux-kernel+bounces-21120-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21120-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id t22-20020a17090a0d1600b0028cd234e938si1175352pja.61.2024.01.10.03.30.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 03:30:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-21120-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; dkim=pass header.i=@arndb.de header.s=fm2 header.b=GpMpkBqF; dkim=pass header.i=@messagingengine.com header.s=fm2 header.b=lpMQg2JN; spf=pass (google.com: domain of linux-kernel+bounces-21120-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21120-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=arndb.de 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 73A09287C2B for ; Tue, 9 Jan 2024 16:43:33 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 21E383A278; Tue, 9 Jan 2024 16:43:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=arndb.de header.i=@arndb.de header.b="GpMpkBqF"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="lpMQg2JN" Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C1D7A38DEF; Tue, 9 Jan 2024 16:43:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arndb.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arndb.de Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id A9DFC5C0420; Tue, 9 Jan 2024 11:43:21 -0500 (EST) Received: from imap51 ([10.202.2.101]) by compute5.internal (MEProxy); Tue, 09 Jan 2024 11:43:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arndb.de; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm2; t=1704818601; x=1704905001; bh=bFVuHUCmJx RAxC1zh4/opM0gyA5+TjTOo7qCFS2FRg8=; b=GpMpkBqFdcC9HbridPbMFDXLTY 7XFWI33bqAc9K/un9q1zUsVraGDDhNXA0/FO4OyeYoEf95URYLF9hyqDQIpYExj9 lHR/+hF50r8ZJkFqMi+C02/uvBuQK8qAtUhxLSXorq1C6Hu/0Ih2xXDIBiCr9ErR SC69eVzAYitvp6Vdjhh0s9mr4RXLMBgbP8MTSbqnIGYMb8lg2UulqDjXNTGDM3R+ 12HidHWsyvrDN1cZgXr1plr4MtbYUhlhM3EMWAR2BbYcLku9nsGvR70yPU8ZebyF o34fCqAKMj1GE7ZnZeQqTzUGryOhlLJLcdY7fBUCUFNZCWUCO7lIdMGnNC7w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm2; t=1704818601; x=1704905001; bh=bFVuHUCmJxRAxC1zh4/opM0gyA5+ TjTOo7qCFS2FRg8=; b=lpMQg2JNziYchTiZ3cWpiuSjUOPLZBbwlhV3BbKiBPcj jgv4H4B5JBVohETIPT/e9gYmgxpDzHNbenG9e8PyN9rBCsu+g5AbjFHE2ebdaY3v oKpv2/L+5a9KaJ0uOa3bRzKwkRZ7tSCcbPsPjSDSSkabcXYPOcq2oIRCZVqRT/L+ FDm5XcStz2CbMpxdx5+qpDAFgOv5n4kZCxH7UI1HM8nKC+KmT9sbZIgYhDkFxGOe BLNh7FuENyzfwifIxX+38CxMEhqi+lYAFIMS9IlNEEfaQzV7clpVh7NR4k6ow+i3 Sw0H0mDXskGBnkOhy1wPnJ5++LUj+5sV/lc+f2gfOg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrvdehledgledtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpedftehr nhguuceuvghrghhmrghnnhdfuceorghrnhgusegrrhhnuggsrdguvgeqnecuggftrfgrth htvghrnhepffehueegteeihfegtefhjefgtdeugfegjeelheejueethfefgeeghfektdek teffnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprg hrnhgusegrrhhnuggsrdguvg X-ME-Proxy: Feedback-ID: i56a14606:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id 83C56B6008D; Tue, 9 Jan 2024 11:43:20 -0500 (EST) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.9.0-alpha0-1364-ga51d5fd3b7-fm-20231219.001-ga51d5fd3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <1633a5e7-213e-4621-bdc5-5cc056da9d99@app.fastmail.com> In-Reply-To: References: Date: Tue, 09 Jan 2024 17:43:00 +0100 From: "Arnd Bergmann" To: "Yangyu Chen" Cc: "Christoph Hellwig" , "Alexander Potapenko" , "Mike Frysinger" , Linux-Arch , linux-kernel@vger.kernel.org Subject: Re: [PATCH] asm-generic: flush icache only when vma->vm_flags has VM_EXEC set Content-Type: text/plain On Tue, Jan 9, 2024, at 15:45, Yangyu Chen wrote: > For some ISAs like RISC-V, which may not support bus broadcast-based > icache flushing instructions, it's necessary to send IPIs to all of the > CPUs in the system to flush the icache. This process can be expensive for > these ISAs and introduce disturbances during performance profiling. > Limiting the icache flush to occur only when the vma->vm_flags has VM_EXEC > can help minimize the frequency of these operations. > > Signed-off-by: Yangyu Chen > --- > include/asm-generic/cacheflush.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/include/asm-generic/cacheflush.h > b/include/asm-generic/cacheflush.h > index 84ec53ccc450..729d51536575 100644 > --- a/include/asm-generic/cacheflush.h > +++ b/include/asm-generic/cacheflush.h > @@ -102,7 +102,8 @@ static inline void flush_cache_vunmap(unsigned long > start, unsigned long end) > do { \ > instrument_copy_to_user((void __user *)dst, src, len); \ > memcpy(dst, src, len); \ > - flush_icache_user_page(vma, page, vaddr, len); \ > + if (vma->vm_flags & VM_EXEC) \ > + flush_icache_user_page(vma, page, vaddr, len); \ > } while (0) > #endif This is not my normal area of expertise, but I wonder if you can't just do this the same way as alpha and openrisc by having the condition in architecture specific code. Arnd