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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE03FC4332F for ; Thu, 2 Nov 2023 16:00:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377051AbjKBQAF (ORCPT ); Thu, 2 Nov 2023 12:00:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235482AbjKBQAC (ORCPT ); Thu, 2 Nov 2023 12:00:02 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 3A4E7186; Thu, 2 Nov 2023 09:00:00 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 41DEC2F4; Thu, 2 Nov 2023 09:00:42 -0700 (PDT) Received: from FVFF77S0Q05N.cambridge.arm.com (FVFF77S0Q05N.cambridge.arm.com [10.1.27.166]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 45F3B3F738; Thu, 2 Nov 2023 08:59:58 -0700 (PDT) Date: Thu, 2 Nov 2023 15:59:52 +0000 From: Mark Rutland To: Alexei Starovoitov Cc: Puranjay Mohan , Florent Revest , Daniel Borkmann , Alexei Starovoitov , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Catalin Marinas , bpf , KP Singh , linux-arm-kernel , LKML Subject: Re: [PATCH bpf-next v4 0/3] bpf, arm64: use BPF prog pack allocator in BPF JIT Message-ID: References: <20230626085811.3192402-1-puranjay12@gmail.com> <7e05efe1-0af0-1896-6f6f-dcb02ed8ca27@iogearbox.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 03, 2023 at 12:13:00PM +0100, Mark Rutland wrote: [...] > However, in looking at it I think > there may me a wider potential isssue w.r.t. the way instruction memory gets > reused, because as writtten today the architecture doesn't seem to have a > guarantee on when instruction fetches are completed and therefore when it's > safe to modify instruction memory. Usually we're saved by TLB maintenance, > which this series avoids by design. Just to confirm on this point specifically, per discussions with our architects, the (architectural) execution of an instruction ensures that there are no outstanding fetches for prior instructions. IIUC that will be clarified the next release of the ARM ARM. So as long as we're certain all threads have left the old code (e.g. via a flag, RCU tasks rude synchronization, whatever) before we overwrite slots in the shared buffer, we should be good. We will need to be very careful with the maintenance when installing new code into the shared buffer (e.g. we will require an IPI to all other CPUs), but that should be relatively simple. I'll go review the latest patches with that in mind. Thanks, Mark.