Received: by 10.213.65.68 with SMTP id h4csp718104imn; Fri, 6 Apr 2018 07:47:41 -0700 (PDT) X-Google-Smtp-Source: AIpwx49U4hrJgkOufzGN1R2mlpuE6UH8kwZYQ6BgN+lOCOaMjsRWIqujRYfQ9j0r0pfmPs+3rcnk X-Received: by 2002:a17:902:7b8e:: with SMTP id w14-v6mr13632739pll.52.1523026061820; Fri, 06 Apr 2018 07:47:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523026061; cv=none; d=google.com; s=arc-20160816; b=jUsX9ruIb9+d0NleXc4QCwQVl0yU4eKGmha3mUH9gTBje/Gi6djhAnoUJYBjiL8+Iu Q1G7r1WnVuyqg/wUqyzP9aP9g5JyxsFloVRZRq9u/R+uyz+pP0N4h5Uy4UEqsD8hrKHU d9pAobxwk37vtepDPGsBJCC9mS3RJtomG3+CWtWwyHgdZNIEUt3NVzuAtVW2sULnadHe GadGSxK/0jEyLmf1DjXUIbFluYMlm9Xjx20b4LchgqgC4Fs5PG/B9sBpMNfYnjmKJcqK e4CTIjhrJojeicMM1zJxiAhH/jKoN5SZSQhXLtASO5I/lKqMTNsRjSwqxtlkzF1MGrWv 5r0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=4r3stDIja+htVwlVY9mCT32KeJnGEU7klHyVyJMFOM4=; b=J7a6nS1efq/nmfSFbmtZLNW67HguZagtSobUARdLGkg5ynGZBUS/2Pj6wrfyhR44i4 BLDoJJGuNAiJhwgp8I7UgA1uWbvRGe+vAYzHVyNLADOk+H5zwX/UerEXrT9F0xfv9BeT gZlo3wA4n9desU8ATWWrrwoikOSJpM6sQQToU4Exja4Md3GGx0R5scyq0b0ki7NKT8jd qeJi5eH2VRaQe7xwTr7tQUdL8wbI+5z0jvejxD/LvIYQ53ueFoQn3h9PDdaDPpfvkgWj 0NTJYph1qHHwhfpT5/BY04sD6d4F5m/nxEwTfjGqxowXiHnPYqb7R+d2HAVsH1KnrWCv zpJw== 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 r3si8045846pfe.147.2018.04.06.07.47.27; Fri, 06 Apr 2018 07:47:41 -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 S932070AbeDFOqU (ORCPT + 99 others); Fri, 6 Apr 2018 10:46:20 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:58042 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755693AbeDFNdu (ORCPT ); Fri, 6 Apr 2018 09:33:50 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 3D4B3CC9; Fri, 6 Apr 2018 13:33:49 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Linus Torvalds , Thomas Gleixner , Alexander Shishkin , Andy Lutomirski , Arnaldo Carvalho de Melo , Frederic Weisbecker , Jiri Olsa , Peter Zijlstra , Stephane Eranian , Vince Weaver , Ingo Molnar Subject: [PATCH 4.9 006/102] perf/hwbp: Simplify the perf-hwbp code, fix documentation Date: Fri, 6 Apr 2018 15:22:47 +0200 Message-Id: <20180406084332.434692680@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180406084331.507038179@linuxfoundation.org> References: <20180406084331.507038179@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable 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: 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: Greg Kroah-Hartman --- 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);