Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp1208715pxb; Sat, 4 Sep 2021 03:26:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyCJ71bYRT+EhWMJBaEsccLxDvqbnv4cw8Cvn07FClXNBWvE+fDS6giZkZVuMU9Mdskw8Ar X-Received: by 2002:a92:c26f:: with SMTP id h15mr2203368ild.47.1630751198935; Sat, 04 Sep 2021 03:26:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630751198; cv=none; d=google.com; s=arc-20160816; b=i7P2mUH3NElbfee/wodces8oVzdJcV+dEQDiohBv/cMkGYwFi3z5s74cxWVan16sgn RkZ38XVGiZ4lGg6Dk0qkE6s2gN2+D78Ag/TyFhOsd55R6FI9tCE109RJnPQ9aMl37RH4 7tVWN5X3PltlcbM/IJZp19GmR8O5A2ZTSDPH5+I8AWtxct+klAAqS3YjkZYKdLQVdrS+ 1vWZ4Og81nsDpOnDIlZ4iEXXy2U9fNqveguQ1yBjVBsO8/2v94qzVwXIT2AuLZUcqU6+ fwMaceqvlmo5T9e4dZR4g6d+5GX5oVrSqtjXJHjWW4MhpkwA5fkjXYmBAIeIhVyhEbGb MlCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=e5R7GYZx+aBiCE582nXkLQEdaHmoBPPfbt7yTR5oZBE=; b=iHHO/uHU+4/Zh/YEk8UBffrhxTvJaUn2rpNl1vEJE/qiRDfepn7MD5gMGRbxJscjW2 erVsiS58Zo/V4flY7tkoswMY0Nvoa2kxJh+7lqL3MJVS8L6iFfxkzK1IO9mvDAvPMOug 7ZDAdrEYJ6vVHm9BpMfjY2ieFXBhceRFgzcetMLc+Eda5SOeYwrwJHSKy0wb/zyVzzun hQRKiJ6soZxD+pdcdqenXW9zdk4J/eAsyXo4NJb8dGEfx79AnBVrrvJsvHzBGgQ4Oyxe mMHEEIyNQd4gKCODc/mMe1oNjC75Vci7H4C7nqcplgt08rkj4YI8ovTwmUqAi6eXiYzF CTHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=JjKzpp7a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t24si1628567iol.88.2021.09.04.03.26.27; Sat, 04 Sep 2021 03:26:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=JjKzpp7a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235983AbhIDKUG (ORCPT + 99 others); Sat, 4 Sep 2021 06:20:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235698AbhIDKUF (ORCPT ); Sat, 4 Sep 2021 06:20:05 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 332C9C061575; Sat, 4 Sep 2021 03:19:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=e5R7GYZx+aBiCE582nXkLQEdaHmoBPPfbt7yTR5oZBE=; b=JjKzpp7aDuZbtXkDdUq/VeGCde DsyFTO9TrKCHJ/TchCVMYyQSOc7W6Me2+EOr1yEaWaDtWf8Dm8B2frXhToYjBKhsdDOIP0joSECaG aRz/iSu3Guu+Cy5R/HMHoS2eYFMP05BER5mw2PtaiR/JmgCwkX5EWhoxFdiqH4oezF30okywUmS1k HSDWX3jXJgUPJFzQvNdlqD/R2tHdF/v4VWUb8AgKf3XhELsCnaHctUQV++jxQ6n/KzPvFJLP4pW5l Gjc+SgoKYpy1WOu4MjCQ+hIGH/nsZSlt4rdUFhjw9WJU2NAF4nY4V0VHMr30rMcUzsVBZyFzrBUNj eRc0oPiA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mMSks-005EM9-Hw; Sat, 04 Sep 2021 10:18:40 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 2BFE5986283; Sat, 4 Sep 2021 12:18:34 +0200 (CEST) Date: Sat, 4 Sep 2021 12:18:34 +0200 From: Peter Zijlstra To: Song Liu Cc: bpf , "linux-kernel@vger.kernel.org" , "acme@kernel.org" , "mingo@redhat.com" , "kjain@linux.ibm.com" , Kernel Team Subject: Re: [PATCH v5 bpf-next 1/3] perf: enable branch record for software events Message-ID: <20210904101834.GC4323@worktop.programming.kicks-ass.net> References: <20210902165706.2812867-1-songliubraving@fb.com> <20210902165706.2812867-2-songliubraving@fb.com> <6BA620C1-D311-4992-8119-68A740ABA8BC@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6BA620C1-D311-4992-8119-68A740ABA8BC@fb.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 03, 2021 at 04:45:29PM +0000, Song Liu wrote: > Hi Peter, > > > On Sep 3, 2021, at 1:27 AM, Peter Zijlstra wrote: > > > > On Thu, Sep 02, 2021 at 09:57:04AM -0700, Song Liu wrote: > > > >> +static int > >> +intel_pmu_snapshot_branch_stack(struct perf_branch_entry *entries, unsigned int cnt) > >> +{ > >> + struct cpu_hw_events *cpuc = this_cpu_ptr(&cpu_hw_events); > >> + > >> + intel_pmu_disable_all(); > >> + intel_pmu_lbr_read(); > >> + cnt = min_t(unsigned int, cnt, x86_pmu.lbr_nr); > >> + > >> + memcpy(entries, cpuc->lbr_entries, sizeof(struct perf_branch_entry) * cnt); > >> + intel_pmu_enable_all(0); > >> + return cnt; > >> +} > > > > Given this disables the PMI from 'random' contexts, should we not add > > IRQ disabling around this to avoid really bad behaviour? > > Do you mean we should add (instead of not add) IRQ disable? Yeah, I tihnk we want local_irq_save()/restore() here.