Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp8203203ybi; Tue, 9 Jul 2019 11:04:04 -0700 (PDT) X-Google-Smtp-Source: APXvYqxxNJZdjMF7Yd4ILPYSQ7xG2CQ/Wz1KSvpJpmMEp+Wmzy/n5tFDnnB+LvFJCwT4NAhZWguy X-Received: by 2002:a17:90a:35e5:: with SMTP id r92mr1605005pjb.34.1562695444579; Tue, 09 Jul 2019 11:04:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562695444; cv=none; d=google.com; s=arc-20160816; b=nJSVTQtM0Xz174KkdxEsCLXY2CBbTxt7lEYDmDjvbG973xjom4ybV4ikgsRDFIbv3n PMueYrLRFUXIb0kHBrX38q3Ei5AtHHx1RndPufqmVhLvBf+3KvSHNrc042QKrSbg/qX8 K0fxvpqx+TTBtkUQHMSrHgbeQSP+l+QstFy4ULVPwN6zUdaLIdYTzbPZN0YuQ3foUoFF Cwm6jL1R1Et4l6lEHl2KvyNW37p2OHhwnqdIr7VeAaUTbQ+8fhIyd2lRUIw324xcvJf+ iNDRMSeM528nm025w4XCkaiW9+xq/2LPvywwIHK3DrnMcwvXCYqAJa4DNY/KeI2Xit0j f23A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=i9R0OFCUL3jMQABVdwSMXWLYp20n1lUt8oNSbrQL6kM=; b=OCyJcpAavVXC1PsO7oHsgd8pgS/GPQ4PDBmllOr0KnBNZgJiqtn1TpKaCE6W3iOwkx ewSeOT7tL1CB3OLe1brJY6zn1T0geFHSjqIpamctCKXv4X2LO9dK/6L/hEy4xHgiba8j Ux7TDfVnYXA6fbaTEgjBiLkBI/52mC21LIfzfgqzP22XkXeg1COR9hZisI9MG42KBSpE UkZAayRHhB66gYOEGOZtPLVrcdQ41DcDnhw2Y7QfV3Bj0aLteqv1ZIzmHqWblVxaOqkn BSzf0ybsZF/e5bnBvrMpt5CTAuqeCWXShg2XkvYruVSZhNGxJoBY7Xd8SBvTk9qBeplx 3NNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=LLKg8zsI; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c64si3417017pje.9.2019.07.09.11.03.49; Tue, 09 Jul 2019 11:04:04 -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=@gmail.com header.s=20161025 header.b=LLKg8zsI; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726679AbfGISCy (ORCPT + 99 others); Tue, 9 Jul 2019 14:02:54 -0400 Received: from mail-lj1-f193.google.com ([209.85.208.193]:38221 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726238AbfGISCy (ORCPT ); Tue, 9 Jul 2019 14:02:54 -0400 Received: by mail-lj1-f193.google.com with SMTP id r9so20459889ljg.5; Tue, 09 Jul 2019 11:02:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=i9R0OFCUL3jMQABVdwSMXWLYp20n1lUt8oNSbrQL6kM=; b=LLKg8zsIA8LoxKo96qzf1ltd7oFHbAEMTv7sEzYlSUfxvJhWHa5kNcnFprPNsJSyFk MAla6ZNU7L6FPV0o0NwCiJxVTIeBi9F97Cw0D4PbDLsrOa38sMh3XGRCslhfI7L4l8aT r5zhgmBQUj2L4FHou33rW3C23oeMfHlKugXRSx/L6q/SQQiRopmb3Lx+gerH9xFATKp5 v02WgvmqKuVNyUdkxakNxbV7si+wiiF7L1u5sXik5M5eGAJcl6+4tgAHWb+QZBJjKH8B TNXFbfuE/gnFXhJHje4fcL5OqkmWdVovl12y6ZYfyf7OkGb7kvMX/Twou4xK5CEReCUm 3GHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=i9R0OFCUL3jMQABVdwSMXWLYp20n1lUt8oNSbrQL6kM=; b=W6ejJJkTKnuIHIpMxKTFxLh8s/MITZHhsShDTcZ2bOG+V/PBml0ZwZFwzvyrwZab/z PiZeLuO5JUnV6b0GwDV20hnGj14O+q5tF/1e9a7a+gZYJFFyVZfsVScNZpFLjIvLTTGe a8ovzG29JCrAT0OBbRB68ZEHjH32X7L8I3KCC40AZsyl23hjbwnhcqrjxmAPWt3fYji/ ouS2vDv7rfsJt1XvnyjuL2pRbM4pvDU+/hImmyDm/1FcN2YTj6clKSWPhE700dXfnjH9 nl0jlgTnfK5DeZ5KQpf09n4ChrPlICC0PvuUdijRf8CYzkgHwlpdEqsh4fUhR4+ACjZo vi4A== X-Gm-Message-State: APjAAAW+Dnfj5mrIgG2clyrq3WXjfcXnpUblUkPpeKU4yDy59OF9tp5j 7E6JQH3wYzmzO3f1U5a0iMzMc+wobcE3R9qf5ZI= X-Received: by 2002:a2e:a311:: with SMTP id l17mr14115937lje.214.1562695372462; Tue, 09 Jul 2019 11:02:52 -0700 (PDT) MIME-Version: 1.0 References: <20190706202942.GA123403@gmail.com> <20190707013206.don22x3tfldec4zm@treble> <20190707055209.xqyopsnxfurhrkxw@treble> <20190708223834.zx7u45a4uuu2yyol@treble> <20190708225359.ewk44pvrv6a4oao7@treble> <20190708230201.mol27wzansuy3n2v@treble> <20190709174744.dtbjm72cbu5fepar@treble> In-Reply-To: <20190709174744.dtbjm72cbu5fepar@treble> From: Alexei Starovoitov Date: Tue, 9 Jul 2019 11:02:40 -0700 Message-ID: Subject: Re: [tip:x86/urgent] bpf: Fix ORC unwinding in non-JIT BPF code To: Josh Poimboeuf Cc: Ingo Molnar , Thomas Gleixner , Steven Rostedt , Kairui Song , Daniel Borkmann , Peter Zijlstra , LKML , bpf Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 9, 2019 at 10:48 AM Josh Poimboeuf wrote: > > On Mon, Jul 08, 2019 at 04:16:25PM -0700, Alexei Starovoitov wrote: > > total time is hard to compare. > > Could you compare few tests? > > like two that are called "tcpdump *" > > > > I think small regression is ok. > > Folks that care about performance should be using JIT. > > I did each test 20 times and computed the averages: > > "tcpdump port 22": > default: 0.00743175s > -fno-gcse: 0.00709920s (~4.5% speedup) > > "tcpdump complex": > default: 0.00876715s > -fno-gcse: 0.00854895s (~2.5% speedup) > > So there does seem to be a small performance gain by disabling this > optimization. great. thanks for checking. > We could change it for the whole file, by adjusting CFLAGS_core.o in the > BPF makefile, or we could change it for the function only with something > like the below patch. > > Thoughts? > > diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h > index e8579412ad21..d7ee4c6bad48 100644 > --- a/include/linux/compiler-gcc.h > +++ b/include/linux/compiler-gcc.h > @@ -170,3 +170,5 @@ > #else > #define __diag_GCC_8(s) > #endif > + > +#define __no_fgcse __attribute__((optimize("-fno-gcse"))) > diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h > index 095d55c3834d..599c27b56c29 100644 > --- a/include/linux/compiler_types.h > +++ b/include/linux/compiler_types.h > @@ -189,6 +189,10 @@ struct ftrace_likely_data { > #define asm_volatile_goto(x...) asm goto(x) > #endif > > +#ifndef __no_fgcse > +# define __no_fgcse > +#endif > + > /* Are two types/vars the same type (ignoring qualifiers)? */ > #define __same_type(a, b) __builtin_types_compatible_p(typeof(a), typeof(b)) > > diff --git a/kernel/bpf/core.c b/kernel/bpf/core.c > index 7e98f36a14e2..8191a7db2777 100644 > --- a/kernel/bpf/core.c > +++ b/kernel/bpf/core.c > @@ -1295,7 +1295,7 @@ bool bpf_opcode_in_insntable(u8 code) > * > * Decode and execute eBPF instructions. > */ > -static u64 ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn, u64 *stack) > +static u64 __no_fgcse ___bpf_prog_run(u64 *regs, const struct bpf_insn *insn, u64 *stack) I prefer per-function flag. If you want to route it via tip: Acked-by: Alexei Starovoitov or Daniel can take it into bpf tree while I'm traveling.