Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2484483rdb; Wed, 15 Nov 2023 01:58:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IGsB/hq5b9Imo4YgG4RUK2Go1nfyeGVAOTXZYklEOFrR0m1eXpfrO1MlvvfuDE66RFGoXIm X-Received: by 2002:a17:90b:38c1:b0:280:5e66:a1e2 with SMTP id nn1-20020a17090b38c100b002805e66a1e2mr13616786pjb.22.1700042318300; Wed, 15 Nov 2023 01:58:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700042318; cv=none; d=google.com; s=arc-20160816; b=oClRainBLgRMxD3iJti4VDbXWE65xa3RHM+GSMgWGgbTyV1ZIp1BUU9OtHzkLud9P5 nhjXMpMg0vgSP9pjC2UhGl7pG0CLbd965xYkG74wARAbvKIKFLX3Sp1K8jbiUYPAZvcE ecKa++kW5bx0uzciJZoJbtGF+/y0WffMB+9uViQs9nDetLQriQVosiNRKCGTSt0ZWW4P GdrmEnbbDQuP/A3pYUCQ/l71LCqzg36F13TIn7Ag1bpYN5DnV7Ovj6yB0y0ZouY+MCzW Ymq6YEOmVASZdC4zWOvL7sx/n6vJGr802yZfgWPsa/DeWv2GnYJWmpB4vGxGRSj8MRxn rFCQ== 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=+RCpZLfVgW742tIfwCQVho56eY7hoi5YwvR+26FGo80=; fh=hNzt5+fMnA79hnGaGBKJWvMmyP1siyJizIn9OS05URI=; b=B4Av66s3ZwDYCimQDUEvTJEApL9G33NC6Dl6TedkXf9Xk3rhkIzC78943s6NoYo7dr H/8VTnrQ2NHXgTjKfEjtv0BDUi/+F/LRodMFBY2citDwzwVwwP67KIwn8vAri5gAQFMb 0em1UwgXQZG/0NacxvP1aDv6mV9Lr/Y7RXHcf4OyawikMpezF1mXhLwCiO4W69gZojJ/ i/kxYsTipmx5Z1d0LiKbS/dyqIBDiPVjovIi6dPXJBUvge3zjMpqPPJM2NACOzxCJKfF ihez31AR1KDYqrg5P8Ya3i1eOuE6TgfMhb0F352k1dB9U8VHQMJJHbj9sW/WetZXx2oS jZNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=PrMsifen; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id x17-20020a17090a8a9100b0026b51ae4574si14978650pjn.36.2023.11.15.01.58.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 01:58:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=PrMsifen; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 1C0D3813EAA1; Wed, 15 Nov 2023 01:58:36 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234833AbjKOJ6g (ORCPT + 99 others); Wed, 15 Nov 2023 04:58:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234675AbjKOJ6f (ORCPT ); Wed, 15 Nov 2023 04:58:35 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B066C2 for ; Wed, 15 Nov 2023 01:58:32 -0800 (PST) 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=+RCpZLfVgW742tIfwCQVho56eY7hoi5YwvR+26FGo80=; b=PrMsifeniNlJaEyoTxrdLqQcz6 M29BkTSS6X8woYJD8DAOsgyttbZPG7BmcKwHS5gIsaOgYzEM81Iq99FDjoHLI1nSf3u/fi1PoM/am vWkM22rFJzpSLHWQydbnqzJyoTNcCzDrp10k6zgounCGxcZ5YYSieZyxiZbGwf8EXDJmsXYKpRP7J dMH5+nZ/1M+/gyFymTAzDgmtUe+L/6FBJCtQgiQOIDLZNOBrfHqHP5XZ2DrC2oABID0ZsqW2PVSAJ ltutgwaARWIM3FxhD+MkpRiq89LkEBG91sXCK+45jIoUiIu1NQ1ztONqpJE1pOj2M1S/qaqPKG3rI NpMWDwiw==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1r3Cf3-00DWTm-OZ; Wed, 15 Nov 2023 09:58:18 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id 6ADF63002BE; Wed, 15 Nov 2023 10:58:17 +0100 (CET) Date: Wed, 15 Nov 2023 10:58:17 +0100 From: Peter Zijlstra To: Namhyung Kim Cc: Jiri Olsa , mingo@kernel.org, linux-kernel@vger.kernel.org, acme@kernel.org, mark.rutland@arm.com, alexander.shishkin@linux.intel.com, irogers@google.com, adrian.hunter@intel.com Subject: Re: [PATCH 01/13] perf: Simplify perf_event_alloc() error path Message-ID: <20231115095817.GB3818@noisy.programming.kicks-ass.net> References: <20231102150919.719936610@infradead.org> <20231102152017.847792675@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 15 Nov 2023 01:58:37 -0800 (PST) On Fri, Nov 03, 2023 at 12:50:19PM -0700, Namhyung Kim wrote: > > > -err_pmu: > > > - if (is_cgroup_event(event)) > > > - perf_detach_cgroup(event); > > > - if (event->destroy) > > > - event->destroy(event); > > > - module_put(pmu->module); > > I'm afraid of this part. If it failed at perf_init_event(), it might > call event->destroy() already. I saw you cleared event->pmu > in the failure path. Maybe we need the same thing for the > event->destroy. In that case event->destroy will not yet have been set, no? And once it is set, we should call it.