Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp84955yba; Mon, 20 May 2019 05:26:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqxdSuNyxK4RLe/3ShxvFveIOdjPfX3aSuT53R4BqAW2qbTHuqsgr8vi//IaBOtlrViPmIfY X-Received: by 2002:a63:e43:: with SMTP id 3mr32537721pgo.253.1558355199310; Mon, 20 May 2019 05:26:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558355199; cv=none; d=google.com; s=arc-20160816; b=SZFUbyeDUW6cfIROjkdaRXye3IofhJHezUkkO2BH8Wm9r6klSIoZAe2OD1zTnx6UsC TXAcL2FOfOperRGowh8WeO95FpAOE1TUXAYlcEcCGEnqAg1zHJf9dOAl6lujK+dK8jVR MSbZFTtywdJ30B1wspJY6v1BuXn2vgpNjR+7Fgyz2o12UJLPNJ1Dfbqzy3JzL0Zb3sNZ asJUC1ogoy9r1z1YeA0zNNSyBLBA0ZUky+1GkTukVRYZPNxEhDTeknD+/LcOba+yM5bI ytChrymzku4P9CndFPdvysjB/UZEIq3XGblfpkddr4991ZNFZhClQwSifOr9CR9tXxuh 87VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jWrtMqnitG5k//9OJZ1UsQjLwFY87X4W0msNQdS6XbE=; b=ESExULEBFSNJRl/uKggRqdUzYQMpe6P2et5sMyJEod5hFY67Zi3AN0InbJ1kR4o3/q ltdwuEHX10dIcz0JPkF3jG8MbYaa26j3u6EcW5o4pLA1Q+qb2oCCQDG+3wbjyc2n9QLO 45KbJnCl7jtSKnjVX6sDm9dawILAiYJefagjAj/3m/6rKaYUVmDx6I7crY9XELRoZIKj k4sITXMTPY80GmiDm3eCxcAInaaSm9xHLqWpJImoNAZ44s0ZSTXrSPTNMNHGTIXm1zhz GQxvFSmcyofNSo+OozLjeTXzV+8fUwPEpAlvwQqvGb7Ddg7kLxvwW21jEKsqtmZIQlJN qvnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=A5neoX3t; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g2si17934063pgr.227.2019.05.20.05.26.24; Mon, 20 May 2019 05:26:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=A5neoX3t; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388947AbfETMY4 (ORCPT + 99 others); Mon, 20 May 2019 08:24:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:39854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388938AbfETMYx (ORCPT ); Mon, 20 May 2019 08:24:53 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3ACAA216E3; Mon, 20 May 2019 12:24:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558355092; bh=FcbSSqQ2ufZwGDRJKHsUtRTUpmwDO0WjzJeRwFwwDlk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A5neoX3tWxVd1V8nm9/bSlU7Q3wuvrprXcPzA4fOwfc3M+uPCWPL2biaM1SGrxKzE 9VVc9Zlz1ZcwYkuziJGS100XvhsavcTs7GNcLTs9Wzxu3wdB949yy+2yCrtMC1xlN5 pFxdwNlOz6Ty90YGrgWDf2EoGbrz7aexNZ+/Wt3s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Will Deacon , Daniel Borkmann , Jean-Philippe Brucker , Alexei Starovoitov Subject: [PATCH 4.19 043/105] bpf, arm64: remove prefetch insn in xadd mapping Date: Mon, 20 May 2019 14:13:49 +0200 Message-Id: <20190520115249.999837329@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115247.060821231@linuxfoundation.org> References: <20190520115247.060821231@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Daniel Borkmann commit 8968c67a82ab7501bc3b9439c3624a49b42fe54c upstream. Prefetch-with-intent-to-write is currently part of the XADD mapping in the AArch64 JIT and follows the kernel's implementation of atomic_add. This may interfere with other threads executing the LDXR/STXR loop, leading to potential starvation and fairness issues. Drop the optional prefetch instruction. Fixes: 85f68fe89832 ("bpf, arm64: implement jiting of BPF_XADD") Reported-by: Will Deacon Signed-off-by: Daniel Borkmann Acked-by: Jean-Philippe Brucker Acked-by: Will Deacon Signed-off-by: Alexei Starovoitov Signed-off-by: Greg Kroah-Hartman --- arch/arm64/net/bpf_jit.h | 6 ------ arch/arm64/net/bpf_jit_comp.c | 1 - 2 files changed, 7 deletions(-) --- a/arch/arm64/net/bpf_jit.h +++ b/arch/arm64/net/bpf_jit.h @@ -100,12 +100,6 @@ #define A64_STXR(sf, Rt, Rn, Rs) \ A64_LSX(sf, Rt, Rn, Rs, STORE_EX) -/* Prefetch */ -#define A64_PRFM(Rn, type, target, policy) \ - aarch64_insn_gen_prefetch(Rn, AARCH64_INSN_PRFM_TYPE_##type, \ - AARCH64_INSN_PRFM_TARGET_##target, \ - AARCH64_INSN_PRFM_POLICY_##policy) - /* Add/subtract (immediate) */ #define A64_ADDSUB_IMM(sf, Rd, Rn, imm12, type) \ aarch64_insn_gen_add_sub_imm(Rd, Rn, imm12, \ --- a/arch/arm64/net/bpf_jit_comp.c +++ b/arch/arm64/net/bpf_jit_comp.c @@ -736,7 +736,6 @@ emit_cond_jmp: case BPF_STX | BPF_XADD | BPF_DW: emit_a64_mov_i(1, tmp, off, ctx); emit(A64_ADD(1, tmp, tmp, dst), ctx); - emit(A64_PRFM(tmp, PST, L1, STRM), ctx); emit(A64_LDXR(isdw, tmp2, tmp), ctx); emit(A64_ADD(isdw, tmp2, tmp2, src), ctx); emit(A64_STXR(isdw, tmp2, tmp, tmp3), ctx);