Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3438131imu; Sun, 11 Nov 2018 15:05:56 -0800 (PST) X-Google-Smtp-Source: AJdET5d5nJgkTU1YA4VcFq9kxzV+I7LaKZsbtM/2iiF5HIKZJsIPMMvJJOtUkMUHrEqYyboelgLZ X-Received: by 2002:a17:902:8214:: with SMTP id x20-v6mr17050767pln.224.1541977556025; Sun, 11 Nov 2018 15:05:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541977555; cv=none; d=google.com; s=arc-20160816; b=O97qAptNJChBseTgVad5ZrqyqZSlQAPMiUvh88XNW8io6al0Z2Cm26tmDEYDVh2Tfv 5jGL+mDFu45iwW/oztSJSy2rD2G6C79WbO+n9yhl9T4jEKBilOACE6o4fX4SPAEMKQsF vj9yp3RqvqpZE2EGwZ6GHjfz0RlnCyd7ighH8F2PSJMv/CSS2msWqvyGLmhl9tXUfRU5 QPMZUCtP9XAggUKP1kErHI/DrHjQmQH7pf4c+CM+J9t4b+02aD/RZqD6CgEpbd7B2+oE VTL5BAThL9g1T7jOg9U+5DXLoz3y0Y5IxxUsBy9GN4ezbRrH7w6NA/xJeSqB8p1JHS5c BgLQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OfrcnENzOcOYpWVhSeYdxIt8Z46BKEKrmWZ7ImzsKX0=; b=G4h5Lf9cBHPyOU4J0GMEg2jqtQMjDse3MWE/nzHKEcXUKGi4UNbMoQebrhX5rMKMVg rHVYGrMJWJRgG9YtYLMWAIwUOTlbOAw5K2Y6VIse0k9A3Q3yuzgU3wsHVPN8KCQnYNMY uwolob/nqZWSIx0GDNppDF+N9jMOCSPrBbB89V2zSfBTnYnGzQ1xeRUv4YEHS0n5a+WC S9dlHczccUtMySbkJ6gTDhWN7WtOUZlja93yiRmX8fwma/uL9S4enkrouyCgpCYzJ6WS Dzlv1zR/Y7p8+cJfZQ/FRy2AqlZSm1YsC8GCthxbNgtbaMcAm0YJkJ+wBuj6Nxd0hfi6 wjDA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Q6+/vbNt"; 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 o186-v6si17376926pfo.236.2018.11.11.15.05.40; Sun, 11 Nov 2018 15:05:55 -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=@kernel.org header.s=default header.b="Q6+/vbNt"; 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 S2390503AbeKLIWT (ORCPT + 99 others); Mon, 12 Nov 2018 03:22:19 -0500 Received: from mail.kernel.org ([198.145.29.99]:51248 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387738AbeKLIWS (ORCPT ); Mon, 12 Nov 2018 03:22:18 -0500 Received: from localhost (unknown [206.108.79.134]) (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 12ED7216FD; Sun, 11 Nov 2018 22:32:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975541; bh=SEUMsag8TDxcxGNBUrgWMvjVdpytKGiqCUuMiiKH/UM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q6+/vbNt2OKOwEAs3UzMhjQv0phNo9cpCismc+Jg0GJyyZ4bpMT7+9DfNitQR47TT 09ONg5vuIFiVwItVHgVirrkAhfmD/9MEQIbBn8xynFCqKOzXpD5M73dsmb7zcUhhi9 JpaJPQP6g7JpDi/bNwQMK1eD5aLDFG9vrBn6TxR4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 030/222] sparc: Throttle perf events properly. Date: Sun, 11 Nov 2018 14:22:07 -0800 Message-Id: <20181111221650.955207482@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221647.665769131@linuxfoundation.org> References: <20181111221647.665769131@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: "David S. Miller" [ Upstream commit 455adb3174d2c8518cef1a61140c211f6ac224d2 ] Like x86 and arm, call perf_sample_event_took() in perf event NMI interrupt handler. Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/sparc/kernel/perf_event.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/arch/sparc/kernel/perf_event.c +++ b/arch/sparc/kernel/perf_event.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -1612,6 +1613,8 @@ static int __kprobes perf_event_nmi_hand struct perf_sample_data data; struct cpu_hw_events *cpuc; struct pt_regs *regs; + u64 finish_clock; + u64 start_clock; int i; if (!atomic_read(&active_events)) @@ -1625,6 +1628,8 @@ static int __kprobes perf_event_nmi_hand return NOTIFY_DONE; } + start_clock = sched_clock(); + regs = args->regs; cpuc = this_cpu_ptr(&cpu_hw_events); @@ -1663,6 +1668,10 @@ static int __kprobes perf_event_nmi_hand sparc_pmu_stop(event, 0); } + finish_clock = sched_clock(); + + perf_sample_event_took(finish_clock - start_clock); + return NOTIFY_STOP; }