Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2434046imm; Thu, 7 Jun 2018 10:30:04 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJ3KKvGvHoxcfCWAsngFd9/M+HorbdxRm3mMXBFr6Bf3egbfLSpD2025ciYa/Ebt7k/au1h X-Received: by 2002:a17:902:6b86:: with SMTP id p6-v6mr2941695plk.75.1528392604405; Thu, 07 Jun 2018 10:30:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528392604; cv=none; d=google.com; s=arc-20160816; b=zoaUCJG7Kz9YA0Xfb4LLBsPLwyg0l0m3fhNHYWI2O85/GU0Sz6BclFNTWEcUJmAicw 02KhLKMzp2EKn1+i/eviMsTnULfHRQe1O3H4SyZtUMH7i9EoaSmlpV05PVJUucm0mKfk pprzAlv/aLHtCMgosQqr2snihquq3uiTEFQf8J970GXs6I3m0iVHcbSxlFSm+s538CKy RfRMefezqxIjzf0oKVhK2nVbK4AuOK8F+gROhXih5MyAJFy/Ay3GQmWi1BWwFmQ0Yb6N 5/+uquodZgTKfpM4h2Ri7XNLOdu14GDvFRHSP/If64UNU0fdwSL2VXUiIp+27RuXDYWi fjxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=dxouaq5UZgXABdO8+0UVChJONs0AAxW1Q8G8Yutw858=; b=wEKV52YA3xDrMj0c2AKc7mN1MiwLC4/4QuQH4Zz0LabOW8DgR3Lgwk3dSCzC2x1nI5 5XSq4ozy4aUTpX2rfSeyH+kjgMHOgF3nd7P8GLaBm1wHg0pkWGRVIfNu4AIgnqyVa+5U 7es7vTTs5Ps1H/J7FkjiXFlboO/bTo+JadNtsYhGk1Z0A/Nx8zpXbIYjKy3hljj+2Zx3 LTwtgqfKlEjHXH9923737BdWpbaHx8UvsCSl5Mrc74lCFqI6taxMCYB3fXUBVQXk8wZT WxcE7q0PjtN7MZOZr/7yVxyjRP96WJCdZ496rOFyjskgFY5hrynA/IwLpy33H1ENzjCz zgOA== 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 m4-v6si20691204pgd.518.2018.06.07.10.29.49; Thu, 07 Jun 2018 10:30:04 -0700 (PDT) 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 S934135AbeFGOgt (ORCPT + 99 others); Thu, 7 Jun 2018 10:36:49 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:40423 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933652AbeFGOgp (ORCPT ); Thu, 7 Jun 2018 10:36:45 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvbz-0005Zv-Ti; Thu, 07 Jun 2018 15:10:00 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvay-0002j0-BG; Thu, 07 Jun 2018 15:08:56 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Peter Zijlstra" , "Arnaldo Carvalho de Melo" , "Stephane Eranian" , "Jiri Olsa" , "Ingo Molnar" , "Alexander Shishkin" , "Linus Torvalds" , "Thomas Gleixner" , "Vince Weaver" , "Andy Lutomirski" , "Frederic Weisbecker" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 036/410] perf/hwbp: Simplify the perf-hwbp code, fix documentation In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Linus Torvalds commit f67b15037a7a50c57f72e69a6d59941ad90a0f0f upstream. Annoyingly, modify_user_hw_breakpoint() unnecessarily complicates the modification of a breakpoint - simplify it and remove the pointless local variables. Also update the stale Docbook while at it. Signed-off-by: Linus Torvalds Acked-by: Thomas Gleixner Cc: Alexander Shishkin Cc: Andy Lutomirski Cc: Arnaldo Carvalho de Melo Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Vince Weaver Signed-off-by: Ingo Molnar Signed-off-by: Ben Hutchings --- kernel/events/hw_breakpoint.c | 30 +++++++----------------------- 1 file changed, 7 insertions(+), 23 deletions(-) --- a/kernel/events/hw_breakpoint.c +++ b/kernel/events/hw_breakpoint.c @@ -427,16 +427,9 @@ EXPORT_SYMBOL_GPL(register_user_hw_break * modify_user_hw_breakpoint - modify a user-space hardware breakpoint * @bp: the breakpoint structure to modify * @attr: new breakpoint attributes - * @triggered: callback to trigger when we hit the breakpoint - * @tsk: pointer to 'task_struct' of the process to which the address belongs */ int modify_user_hw_breakpoint(struct perf_event *bp, struct perf_event_attr *attr) { - u64 old_addr = bp->attr.bp_addr; - u64 old_len = bp->attr.bp_len; - int old_type = bp->attr.bp_type; - int err = 0; - /* * modify_user_hw_breakpoint can be invoked with IRQs disabled and hence it * will not be possible to raise IPIs that invoke __perf_event_disable. @@ -451,27 +444,18 @@ int modify_user_hw_breakpoint(struct per bp->attr.bp_addr = attr->bp_addr; bp->attr.bp_type = attr->bp_type; bp->attr.bp_len = attr->bp_len; + bp->attr.disabled = 1; - if (attr->disabled) - goto end; - - err = validate_hw_breakpoint(bp); - if (!err) - perf_event_enable(bp); + if (!attr->disabled) { + int err = validate_hw_breakpoint(bp); - if (err) { - bp->attr.bp_addr = old_addr; - bp->attr.bp_type = old_type; - bp->attr.bp_len = old_len; - if (!bp->attr.disabled) - perf_event_enable(bp); + if (err) + return err; - return err; + perf_event_enable(bp); + bp->attr.disabled = 0; } -end: - bp->attr.disabled = attr->disabled; - return 0; } EXPORT_SYMBOL_GPL(modify_user_hw_breakpoint);