Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (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 718071D531 for ; Thu, 2 Nov 2023 16:00:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=none 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> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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.