From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 38ACCCF9C72 for ; Mon, 23 Sep 2024 16:05:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=RCGBZsuA/9m6tBu8Tf9lyfzIUmgy8K5HG9KPQm5IWzI=; b=wPk95X0OIyBz1JZSjQzU/7DJg+ lNWEHNMmSlChYM0kyHH6Yi5TtHEAQULK2eLx1ltZ0qzkRKIZsJrte6HwFLr5YXOJjVFv+SwVyu7iM iykvULEGp1aFDNaYyWaeuG3cwExxHFbp+wlrhEX1a47bkU8bldq4X+IuhQq7W5GGwZMJkNU7GRetB FHLgWBK+D8dn2RYZWwhSjTOa/YJCncSonSmBhFyq4Z7hmMMOfbo5gTCVKhc8t2Pee6OK9r+9ucctm tfOT9aApQwaJoatno8HZ2q4ij+0Mbbck6GA51gplb2zlPAsiqidT8OxoNd4RiUslkqSQ/HEZM0VT0 r/vp+bfA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1sslYn-0000000HZyF-32Qz; Mon, 23 Sep 2024 16:05:13 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1sslXe-0000000HZeY-27e6 for linux-arm-kernel@lists.infradead.org; Mon, 23 Sep 2024 16:04:03 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id A0EEB5C068C; Mon, 23 Sep 2024 16:03:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8FB45C4CEC4; Mon, 23 Sep 2024 16:03:59 +0000 (UTC) Date: Mon, 23 Sep 2024 17:03:57 +0100 From: Catalin Marinas To: Will Deacon Cc: "Liao, Chang" , Oleg Nesterov , mhiramat@kernel.org, peterz@infradead.org, mark.rutland@arm.com, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] arm64: uprobes: Optimize cache flushes for xol slot Message-ID: References: <20240919121719.2148361-1-liaochang1@huawei.com> <20240919141824.GB12149@redhat.com> <41fdfc47-4161-d2e4-6528-4079b660424f@huawei.com> <20240923071856.GA31866@willie-the-truck> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240923071856.GA31866@willie-the-truck> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240923_090402_606248_C52154F4 X-CRM114-Status: GOOD ( 16.52 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Sep 23, 2024 at 08:18:57AM +0100, Will Deacon wrote: > On Mon, Sep 23, 2024 at 09:57:14AM +0800, Liao, Chang wrote: > > Unfortunately, the comparison assumes the D-cache and I-cache are already > > in sync for the slot being copied. But this assumption is flawed if we start > > with a page with some random bits and D-cache has not been sychronized with > > I-cache. So, besides __GFP_ZERO, should we have a additional cache flush > > after page allocation? > > No, I think Oleg's right. The initial cache maintenance will happen when the > executable pte is installed. For some reason I had kprobes in mind, did not realise that this page ends up in user-space. So yes, we have cache maintenance when the pte is set to point to this page. Subsequent changes will need cache maintenance. > However, we should use __GFP_ZERO anyway because I don't think it's a > good idea to map an uninitialised page into userspace. Oh, that's not good. -- Catalin