Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp2661019rdb; Wed, 15 Nov 2023 07:13:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IG5EypC/mVfXMFpLzrdRTkxnMsnN/V9d7tSJY/yxQiIjqwXYRbD+ebuDv+wof7CIptvZ32F X-Received: by 2002:a17:902:8b85:b0:1cc:68a5:f397 with SMTP id ay5-20020a1709028b8500b001cc68a5f397mr5621694plb.51.1700061193906; Wed, 15 Nov 2023 07:13:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700061193; cv=none; d=google.com; s=arc-20160816; b=pXZfyVM8K8f8QwcFMUyIvT2xDLidsNfIf81VLOKMAY/1Wc+bX4jNuzyb245xyoF/vn lhqZKR27AqMGy0W2LszcjvRTaVbD55we7YiH8iUVqukpcY/FBdgkQzX4xWWUNalebREV VZZxMkP0h9HZwGGwXD8WRhIUZ6zUFeDnNRG84agMiBj8JfHKU4ZtmMxw7PLfZ6mMsa2S Rhu5tRLzPsQLou+cmiIHqBgaXUDxdpGxgnxAtzjYyHgxHofQqLlSUoCaUL2bp6NWw1UK fJZ/crelCoA0XetF6DoEhxzCKwSmJqa5ukDB8EBzPAeKvCkx7xGQfcKkjCUA+pUC8ffL 7XIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version; bh=/F0mSbdZeUND81Qx7UT1XGZdNt3l/lgV496z/7AUc4E=; fh=lD86/ItKvZ/18EpGBG2tuZ2IIg7Ic9eA4mSyy4ElJHA=; b=srdkwbAMtkZ666Fh8+DDka9JSlUysR7fyLiEsxqiLEC6FGMGG9QqyymHd5dQhNKsus m+C9kokiNIUHXVeaSGoHwhMCs61xpfzZmEwznZunLr+CT3RByqcHBbla5WkybPlh9wHb ywrpwvNtyk4Ks9NuRk1f78awEc/bQ6t33XI45DSWcBQBFjfk23g+up1AgEEn6SfRd/Sy Cyq4dmPmjSzCEM7CjgCaV1f6UU78c0cSYe57l/jpPGZzWh3yH6Cixm4hZL0iWULsdwaf osIurxnIY8pMkkysGRxTOBzmUaQ+CItEOgx+3v6Hy+V0D7YNClU5xlzcNC+T9l1Pm1AY WHOg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id b10-20020a170902d50a00b001c9ff840285si11096759plg.414.2023.11.15.07.13.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 07:13:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id C213281DE213; Wed, 15 Nov 2023 07:13:11 -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 S1344418AbjKOPNG convert rfc822-to-8bit (ORCPT + 99 others); Wed, 15 Nov 2023 10:13:06 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344410AbjKOPNE (ORCPT ); Wed, 15 Nov 2023 10:13:04 -0500 Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F2A6DC7 for ; Wed, 15 Nov 2023 07:13:00 -0800 (PST) Received: by mail-pj1-f47.google.com with SMTP id 98e67ed59e1d1-282ff1a97dcso498829a91.1 for ; Wed, 15 Nov 2023 07:13:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700061180; x=1700665980; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=FXCJixjJgHg5fxVASLxV1bYeFt3XpDHx8wFlXRdXihw=; b=HOIbmgHoz2aCsNNubIYu1tw6SEm5DGuCi1C9ho0iJkeGf0OkbRhaeIAEe2MA035dcR iTqTjXdFYqk0M4eATNlny00sL9wDu1yJbpYmjRWxC7gKk78ZsrmFY49Ld1HtVe2yGf6O Y4XmwTnBqfZAamYPHvVvGjj2ZcXXKSRQ6s3vhxiZudhzKK5bRRCJ2O8E92myFZlmwKOM 2kikABbkX7fsy65JftVwgRqcrSZENCkvw6VtS4jD6ZpR6zOE0F7g59l1EIvE4KQ20JNU 90VI5cDBNtaNvzL5k6cMi/OLyk4zu6TAUFX2sh2I1r1fktGZB+j/zWmq2INkracmjgOR W7Gw== X-Gm-Message-State: AOJu0Yx/0EGE0Lkdamu1AeiHfITTuXsgot2d0iGs9TcpIjljUD1JZ2AK K6sgM/RKuM8N6pK0h3BhuR73u/4MAFugJWAKF2c= X-Received: by 2002:a17:90b:1d8e:b0:27d:3be:8e13 with SMTP id pf14-20020a17090b1d8e00b0027d03be8e13mr11015849pjb.12.1700061179919; Wed, 15 Nov 2023 07:12:59 -0800 (PST) MIME-Version: 1.0 References: <20231102150919.719936610@infradead.org> <20231102152017.847792675@infradead.org> <20231115095817.GB3818@noisy.programming.kicks-ass.net> In-Reply-To: <20231115095817.GB3818@noisy.programming.kicks-ass.net> From: Namhyung Kim Date: Wed, 15 Nov 2023 07:12:48 -0800 Message-ID: Subject: Re: [PATCH 01/13] perf: Simplify perf_event_alloc() error path To: Peter Zijlstra 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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no 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 07:13:11 -0800 (PST) On Wed, Nov 15, 2023 at 1:58 AM Peter Zijlstra wrote: > > 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? In perf_try_init_event(), it calls event->destroy() if set when it has EXTENDED_REGS or NO_EXCLUDE capabilities and returns an error. Thanks, Namhyung