Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp224585yba; Mon, 20 May 2019 07:41:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqyUrNTa7TYmc9hHAYW9rnxHi50qO88MVuSCEZ27CW1yL2lSF54dUQLx90/7xOYa8ViMhzzo X-Received: by 2002:a17:902:8a4:: with SMTP id 33mr48511614pll.19.1558363316445; Mon, 20 May 2019 07:41:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558363316; cv=none; d=google.com; s=arc-20160816; b=Wba8htabSU9lBhzvl2QvOHqlfawuEfiP8B9RiPVsquPvb+/oT5nHV1GiOr8QcitT75 FhShtuMTv1JUDu8IQSOmM8li/ARojrF8YMvif5pV+F0/u5nDSqNihJgkCs5spwfCcIcv ZHKLcpySdVD2ogP579rmsXMQ6Q7OusufCtE5yyH2jaYyZ9B8rhYdm60Duo5/leQ36DBf lrIP6ovnwTGrFW6LZd0fbTQe/TmqnSCzz0tikidcqSzexwioIeEKtmHiC514dicJB8EB EmFmYSohMUToxjLsOgFTB0v2wKP/mNzjs/dNE/hnMk0q3GV7Q4foMhnoIea0FFlWtIhr 5rrw== 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=39piBxeJB6Qnd83xxzWYGbO7qtriZcLaUui2FovL8Jg=; b=K+NM2Uv+l1ZkOFnVssdM0DxgB+PH05BZQkI2f09SdZ05XdNn3rlETjKY2pu4TDx14g xiiQsW/sW4dj3tpkqYOejIC88kb280ukujsaXpMDY1+cSsRivd06By8WDehHM+J2aJeL ewJ2WeLmTU5MeVmnMKM7erX1bkfe5BF+oyx4XgrakbF6bHblbTmuteVjhMepVJN1+dxU QLCF/FM1Zv+KdHo7w56cADQKZhr9fdEeXDIIz0zDQYTlOo4Ocl3hdklsjC2IFgN241Xm nnDGlc8MootoEgaKNJaghcBQtVTS1IWEorcrD9U5D1oMt1bw6FyIqWmAodpyfFF25n3X +Ohw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=J+DSeOxq; 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 q12si18684969pgh.594.2019.05.20.07.41.41; Mon, 20 May 2019 07:41:56 -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=J+DSeOxq; 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 S2387809AbfETMTV (ORCPT + 99 others); Mon, 20 May 2019 08:19:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:60568 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387801AbfETMTR (ORCPT ); Mon, 20 May 2019 08:19:17 -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 1F59C20815; Mon, 20 May 2019 12:19:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558354756; bh=nkjVUnaYiahUX1ExbUzV/31xwNKk5fVHRqckHsd1opo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=J+DSeOxqOT//I61+S+O/i5OYJx5qZ40gPNM3/IPK2P5OztegDj8vgE3mgRlf9PA7+ qZlvdls4dfcLYmK+sHB9yzlbG+MIIxo9cFugABXLC/RFU1FdDRQ1q1CDK/4kuuZMHz h6HFzLuw9L76W8a1UYK5FLpGJQHR+xl+p8Nc616g= 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.14 31/63] bpf, arm64: remove prefetch insn in xadd mapping Date: Mon, 20 May 2019 14:14:10 +0200 Message-Id: <20190520115234.777269637@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190520115231.137981521@linuxfoundation.org> References: <20190520115231.137981521@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 @@ -712,7 +712,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);