Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp15315093ybl; Tue, 31 Dec 2019 05:36:53 -0800 (PST) X-Google-Smtp-Source: APXvYqyEi0YHpsrZ6oDpsIfHASegbLQksmaijTIICxhHwDxwxgfHL7hWQuxlJKzhEnv10PCy9qEm X-Received: by 2002:a9d:ec1:: with SMTP id 59mr76417136otj.141.1577799413247; Tue, 31 Dec 2019 05:36:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577799413; cv=none; d=google.com; s=arc-20160816; b=Pt7LU3AXVoTjCQO18vfPSwAX5Ffv3RxGBh5+okHbETEiZSpAUZsKx0aABzeC9UiAW0 dyZvj1y1XkkRSq3C0mmau+326J5PRthDSW3dcasWmyHVDSl03Qr/6yvzZ86qDhaXt0no Rs/psVc+VJz96n4/vYP/CdInq3Dmdwm4hNfKWmmBrnl/6lbX79+RUzBDG0h6SClF3zIl aEvzVh6lO7r4OpKOxenyFCAqJ/ozPK9Ho77YSBJ+wkzJxTE5TMyeAzfDGc5c9wPx6YXQ ekIHvaOKMesPFGlDsER3z8gpzwCaZybBnlX/E+Oibe1lKr8wo8nxNpIV45cnbwnlqj/X tR7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=dEit719n2Ik36OhY/hE3/4A9AQeh6rXuvoLsvQp2DrE=; b=ZsfNli162JMiEBnATJo6RvZdIG7X5Ux1sMGjD9fAoo8E/mGQ57196rv7QQWDwQMUOW UaNQL+Y5IBt/ZQh8bM9gQ+SUS7q8Z+fayRmeUNmRdAHh2LLzljmoHLxsK+8lOLevwcsb EduRFCblYls/bs3HK3CNaol+5OnRzqY2ExOp6Yzl8AwcByRWYkL74MPGmvLdq7nPB2vP +pBe7TK/+2OEEWFvM3f5KuRt/C17OltS8417eESm+UeHw2b0255R/A2+eEWIa61wDhJg vN2bnQZtVe0zyu3iHdGl9jnlA4/yU5Rhyc68JBU9dSiJhPVkiO1jX5G4j6Rc+4D7apMi 7znw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=izoC2nmZ; 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 z1si24989312otm.242.2019.12.31.05.36.40; Tue, 31 Dec 2019 05:36:53 -0800 (PST) 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=izoC2nmZ; 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 S1727054AbfLaNfp (ORCPT + 99 others); Tue, 31 Dec 2019 08:35:45 -0500 Received: from mail-pj1-f66.google.com ([209.85.216.66]:39401 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726060AbfLaNfp (ORCPT ); Tue, 31 Dec 2019 08:35:45 -0500 Received: by mail-pj1-f66.google.com with SMTP id t101so1232277pjb.4 for ; Tue, 31 Dec 2019 05:35:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dEit719n2Ik36OhY/hE3/4A9AQeh6rXuvoLsvQp2DrE=; b=izoC2nmZ/zXLGi9aRbnLJsWJYaP4LeBp8QtAfnx+zUT2T8CxRnppRCRNji8J0K4CA8 PYDe/gZSqieXnH4mEqfd+EFHUZ6Kq4fbED4NImWxh72N7GNwGIEB6txrOk291AT2g6cz OFzrRzn3wScUNxx9XFNXxCmt7firufX3/QJuw2CxiBGr/8OQDDM8I2mtqvMSlksTouzP pF9Duy1pjVCcqdOeRMjxITT98eDFT7/KjNiFwFgsF0R8ASfUSBjTI02CgoFygEv+s7xq IiI68FLkhCElwGaCQEwzog4T2MZaAfRyZe+ZDjkY6ZfTy+jRY2wDntV9cSo7ec5Wf6Kr Asdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=dEit719n2Ik36OhY/hE3/4A9AQeh6rXuvoLsvQp2DrE=; b=VJYwjaIkXZKvY+TXNzV9Djp7PPYQ0uj8FFMirsdpiEHZXna697lwl2CSiDY8FTU6j6 7/o29KCiITqOdW7AwvioQEVD9l9ie0/NsAR9Pmb7bVZAY+yuf7iEKsfqi215dKsJxYvA YAQ+D5fhYty2arlz2gtYD7wuENZUrCG80Q3RxRrT6bJkB8MUTGriOI7F9igGXcCOTiu7 c6HA3EPiAy3CH7RVy9ujuTPlPF0EaLmbFIexPR+TjHC79jebVeaDS1Z5GuhmDVMc9Ju9 5cpyiKr3m0Q8i3TasSZzn/3kkptwzybF7w5awYtubBFh99HtZK6eBs1sSMtCk8WUsR0u wTPw== X-Gm-Message-State: APjAAAUMYVTFT//soIozOsT32NlsIR0fr/iyD2Ae37bswXM8QRf/VjxM KPQvvYUUHauZ+meNmvGkyus= X-Received: by 2002:a17:90a:35e6:: with SMTP id r93mr6362250pjb.44.1577799345086; Tue, 31 Dec 2019 05:35:45 -0800 (PST) Received: from localhost.localdomain ([2408:8025:ad:7e20:f8a1:4793:6c48:941]) by smtp.gmail.com with ESMTPSA id e10sm57903910pfj.7.2019.12.31.05.35.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Dec 2019 05:35:44 -0800 (PST) From: chengkaitao To: rostedt@goodmis.org Cc: mingo@redhat.com, linux-kernel@vger.kernel.org, smuchun@gmail.com, Kaitao Cheng Subject: [PATCH] kernel/trace: Fix do not unregister tracepoints when register sched_migrate_task fail Date: Tue, 31 Dec 2019 05:35:30 -0800 Message-Id: <20191231133530.2794-1-pilgrimtao@gmail.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kaitao Cheng In the function, if register_trace_sched_migrate_task() returns error, sched_switch/sched_wakeup_new/sched_wakeup won't unregister. That is why fail_deprobe_sched_switch was added. Signed-off-by: Kaitao Cheng --- kernel/trace/trace_sched_wakeup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/kernel/trace/trace_sched_wakeup.c b/kernel/trace/trace_sched_wakeup.c index 5e43b9664eca..617e297f46dc 100644 --- a/kernel/trace/trace_sched_wakeup.c +++ b/kernel/trace/trace_sched_wakeup.c @@ -630,7 +630,7 @@ static void start_wakeup_tracer(struct trace_array *tr) if (ret) { pr_info("wakeup trace: Couldn't activate tracepoint" " probe to kernel_sched_migrate_task\n"); - return; + goto fail_deprobe_sched_switch; } wakeup_reset(tr); @@ -648,6 +648,8 @@ static void start_wakeup_tracer(struct trace_array *tr) printk(KERN_ERR "failed to start wakeup tracer\n"); return; +fail_deprobe_sched_switch: + unregister_trace_sched_switch(probe_wakeup_sched_switch, NULL); fail_deprobe_wake_new: unregister_trace_sched_wakeup_new(probe_wakeup, NULL); fail_deprobe: -- 2.20.1