Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp8528870imu; Tue, 4 Dec 2018 09:44:36 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xno1YrNjK+LcM6KL3RN9wTMuLBw/QLoVihrJFB9jJ0fK8GYMVMlnzLnicdwjk1NiRtPFow X-Received: by 2002:a17:902:b707:: with SMTP id d7mr11994371pls.29.1543945476905; Tue, 04 Dec 2018 09:44:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543945476; cv=none; d=google.com; s=arc-20160816; b=XuB3/ObgGyFZhYsjYFSdm7ZMyV2hX5j+j1zKDgeqg1rVJy7iadLe7yqmmcI/6HdANl eUVsAvhKAPWwjcDGMNdEyAR8k7Plxk2BlPxkh4JhL/WzUycg9v6krHqx4EA/KF0cTYgV YyshLOwTUSkCXYqQ6XD1CsIIrXUrBXxu4yOdaa/mvSwN3weR0ddzJ/JI3U+5fJEsgOF/ d5m6u9cYI6uj7zUIRcqspvDdWZsfvC4Sw8ze70cW0IGs1EHfUzRQlouRfxzKmKPkCgrM a1bkCW4eZijAT411wxFfQ/LnkrlsnTPPOBagFswMArzmBZBISoPOQnDtovEx+Eop92NV SZNA== 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 :references:in-reply-to:message-id:subject:cc:to:from:date; bh=RuYt4kIUqwthZer9aEUP4YaUGCbDRfYNm/syIGE1WEA=; b=rDui0K5wd7+yesn/IPipz86yUhbeupbEeAKwMx+/hNUQDqIMwH+bKxZ65BsJ2cOBpc jUUuXMQ/FJ7LDL4qPewKG2MCe6IwZlNNbc6wC1ub2DpeT0NQb31C3xDch3P9Xf9v/oU5 hMqj6OocZ3/xZI6njFYo8npz0jDr9Z0wbfCgH/dP1o/eFImqQgOiWmCEyTN/CIR8RbxM JLwZksNNR79k+hjKuLEH358iVLNZetHuCz6toQbqvvHx51TpyQDUhjWRh2y7NSMviBqE 9qku+O1dB8YxRflO/dJHBrPaAoQ3Qql1hg654vKb7eRadLctPYZKGjTF2AMF7Bj0rD+y PWBg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u202si17040397pgb.115.2018.12.04.09.44.20; Tue, 04 Dec 2018 09:44:36 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726367AbeLDRng (ORCPT + 99 others); Tue, 4 Dec 2018 12:43:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:58104 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726056AbeLDRng (ORCPT ); Tue, 4 Dec 2018 12:43:36 -0500 Received: from vmware.local.home (unknown [208.91.3.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B5B472081B; Tue, 4 Dec 2018 17:43:35 +0000 (UTC) Date: Tue, 4 Dec 2018 12:43:33 -0500 From: Steven Rostedt To: Masami Hiramatsu Cc: linux-kernel@vger.kernel.org, Ingo Molnar , Tom Zanussi , Ravi Bangoria Subject: Re: [PATCH v2 01/12] tracing/uprobes: Add busy check when cleanup all uprobes Message-ID: <20181204124333.00f4c5ee@vmware.local.home> In-Reply-To: <154140841557.17322.12653952888762532401.stgit@devbox> References: <154140838606.17322.15294184388075458777.stgit@devbox> <154140841557.17322.12653952888762532401.stgit@devbox> X-Mailer: Claws Mail 3.15.1 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 5 Nov 2018 18:00:15 +0900 Masami Hiramatsu wrote: > Add a busy check loop in cleanup_all_probes() before > trying to remove all events in uprobe_events as same as > kprobe_events does. > > Without this change, writing null to uprobe_events will > try to remove events but if one of them is enabled, it > stopped there but some of events are already cleared. > > With this change, writing null to uprobe_events make > sure all events are not enabled before removing events. > So, it clears all events, or return an error (-EBUSY) > with keeping all events. > Hmm, should this patch be marked as stable? -- Steve > Signed-off-by: Masami Hiramatsu > --- > kernel/trace/trace_uprobe.c | 7 +++++++ > 1 file changed, 7 insertions(+) > > diff --git a/kernel/trace/trace_uprobe.c b/kernel/trace/trace_uprobe.c > index 31ea48eceda1..b708e4ff7ea7 100644 > --- a/kernel/trace/trace_uprobe.c > +++ b/kernel/trace/trace_uprobe.c > @@ -587,12 +587,19 @@ static int cleanup_all_probes(void) > int ret = 0; > > mutex_lock(&uprobe_lock); > + /* Ensure no probe is in use. */ > + list_for_each_entry(tu, &uprobe_list, list) > + if (trace_probe_is_enabled(&tu->tp)) { > + ret = -EBUSY; > + goto end; > + } > while (!list_empty(&uprobe_list)) { > tu = list_entry(uprobe_list.next, struct trace_uprobe, list); > ret = unregister_trace_uprobe(tu); > if (ret) > break; > } > +end: > mutex_unlock(&uprobe_lock); > return ret; > }