Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp348610pxy; Wed, 21 Apr 2021 04:42:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGFmNkdrN4TF47huVftE/jNOSawakxDG9jUr77rBOB/bN8Ztnqu3rTcuEPqdqSjYzqh4+t X-Received: by 2002:a17:907:b1b:: with SMTP id h27mr32838572ejl.421.1619005356192; Wed, 21 Apr 2021 04:42:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619005356; cv=none; d=google.com; s=arc-20160816; b=k1Guigdol2YJcZMucmBEaxRK1DQS9eOKwzdhcDua2SdN/VdEiIBMGjaQ/BS59pfsgW QmK0yKQq7OZrKnCOXqdvdzr8laZSqh4dEgUUo2BM2S4cpQiYJrJYrOlchUbQaj3ahECk S6zUqARXqE8IyNdANa0VDazRd3e613so4ly4J68Y1bFkFuSaJcQUNu4FXDIzWokxzaPG 2L52gdnQDlrea9VJn6ZQY9cQSW47p0ajX0fgqHHHTeD/Y+APi6BVSpIijnw8VsfGt9KZ d9kPNrFIzhRgWP3/sRBCK4a0piu21qFS/+8HA90DZZ3Wxi+VdTgmLViKdMX/yvMWpt27 u5FA== 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=dxZzTJUxws0neR0ciyKEBuvmF6WDgchSCraIXxN/vmM=; b=SDfW0R92/CjjE9XEH/qCtp4UrGTcWcovqf0dl6XXGzugrIj8OpsuT4FO0o5stbDqoW obd0v4+imOPgcN8RTPE1FbKFxhF1gDUfuzZ3evBNc4R2NSoWb29ToMUHM5Q9b4tCP5gK ZXWqu/WL/B2beyHnHWHIErMDOyzTQy4OAAK4P4Rn7/JFnC1hdLcYbyueekP5P5F+4iwh BBA5at1FY+zDyNyyqqkJT8BhbV45Vw8MvmhNMR25u3Gu6NE3DnuPx1fmNdWoJxi33as8 0yBu6XEDN7EJFGIlqHkNg3a/JmLAVA3NJUvvnnYcpJJFfFACQeFw2Oktnkeo1GO3Xgq1 mmqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=HC6vscGo; 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 ds7si1519791ejc.72.2021.04.21.04.41.53; Wed, 21 Apr 2021 04:42:36 -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=HC6vscGo; 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 S237589AbhDUJWa (ORCPT + 99 others); Wed, 21 Apr 2021 05:22:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45624 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230516AbhDUJW3 (ORCPT ); Wed, 21 Apr 2021 05:22:29 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C0D36C06174A for ; Wed, 21 Apr 2021 02:21:56 -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=dxZzTJUxws0neR0ciyKEBuvmF6WDgchSCraIXxN/vmM=; b=HC6vscGoP5PMTnoCU/mdcRHGMr LqAsiePoZSD6LwRPVbAQ78AvSaHiPwfo9nTpklNWW4tlmBwZqq94ZNP9+zQvnPvMlM8SwPXYy67OH COjNKQKCdGtcqHM4UUk6jeNRKeYfsv/AUrYQMwdn7cNYmuEzPDww//vo4fTYK3w7cS8OfpisFvDPw 8BV6al+//jMdOlBHYqUMQLcWurj124vZ4SBDSStwt5yLmQ5f7ME3PL802p8BBJHshdrBc3Ry5ZK79 fcj4S3cVwish6k5xDmicv19FqPZJbcUH6mETzKOIL+GwVVDRBxgzX4VktDGoGd5kl8TZALqAzYK+g UbEz0m4w==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94 #2 (Red Hat Linux)) id 1lZ92k-00GJwZ-SL; Wed, 21 Apr 2021 09:21:17 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 8A8303001E2; Wed, 21 Apr 2021 11:21:09 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 786922023C206; Wed, 21 Apr 2021 11:21:09 +0200 (CEST) Date: Wed, 21 Apr 2021 11:21:09 +0200 From: Peter Zijlstra To: Like Xu Cc: Kan Liang , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Thomas Gleixner , Borislav Petkov , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RESEND 2/2] perf/x86/lbr: Move cpuc->lbr_xsave allocation out of sleeping region Message-ID: References: <20210421021825.37872-1-like.xu@linux.intel.com> <20210421021825.37872-2-like.xu@linux.intel.com> <13fd7ac4-46fd-3fa7-0e80-3f46cfc8edac@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <13fd7ac4-46fd-3fa7-0e80-3f46cfc8edac@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 21, 2021 at 04:48:36PM +0800, Like Xu wrote: > Hi Peter, > > On 2021/4/21 16:38, Peter Zijlstra wrote: > > On Wed, Apr 21, 2021 at 10:18:25AM +0800, Like Xu wrote: > > > -int x86_reserve_hardware(void) > > > +int x86_reserve_hardware(struct perf_event *event) > > > { > > > int err = 0; > > > @@ -398,8 +398,10 @@ int x86_reserve_hardware(void) > > > if (atomic_read(&pmc_refcount) == 0) { > > > if (!reserve_pmc_hardware()) > > > err = -EBUSY; > > > - else > > > + else { > > > reserve_ds_buffers(); > > > + reserve_lbr_buffers(event); > > > + } > > > } > > > if (!err) > > > atomic_inc(&pmc_refcount); > > > @@ -650,7 +652,7 @@ static int __x86_pmu_event_init(struct perf_event *event) > > > if (!x86_pmu_initialized()) > > > return -ENODEV; > > > - err = x86_reserve_hardware(); > > > + err = x86_reserve_hardware(event); > > > if (err) > > > return err; > > > > This is still complete garbage.. > > Hhh,thanks for your comment! The nice one was here: https://lkml.kernel.org/r/20210323214140.GE4746@worktop.programming.kicks-ass.net > So do we have a better idea to alloc cpuc->lbr_xsave > to avoid this kind of call trace ? You thinking this is actually hard scares me. Frob something in intel_pmu_hw_config() or thereabouts.