Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp2460213imd; Fri, 2 Nov 2018 11:47:25 -0700 (PDT) X-Google-Smtp-Source: AJdET5cHz1iaz/daMUoS563MnCMXd8etXdbzM6fAHNBB4nc45NSoTi3VPIfuoiUBX+LdLmhRFI47 X-Received: by 2002:a63:a84a:: with SMTP id i10mr12097806pgp.263.1541184445579; Fri, 02 Nov 2018 11:47:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1541184445; cv=none; d=google.com; s=arc-20160816; b=xC81PbaFnrN7vNo7As2iNI2m5/yHwFPjTG71TadXiOCKJ4NYspvw9HA51Of4AQ2oPZ rA5jfOZy84lrTWiCku9FIzIx9Qizr6rPMzlFaYvDBTVMuFm5XS9tBvZ6VYW0g/BOoBRm Xm0wm2Jm8To+MjZNRU9S0VIwY5hFr3fXGVYGJryMZ6Vjh2jPQycfHh6pVb1VBa+Pv9G5 Ki3dM5zmQ7BrMVwhAtV0ZOKUTzAnc8crFkdYvbMTU0YuNycpRDdna25PTM9Firg8coFD CcNDijgD4SgHIorblwCxJNyc5IwQEkpXaV5l8Ko0Ujt91EZv2uNVi7EhXp2H1875WvP3 E3Qg== 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=gwnzGpew5dmLyoHNDwvdDwkJkdLN5fmSBCdCM0BpRCA=; b=mWQl/+NdVCzMOr/x+Yzw/qUf3vyq+3Av8hCeed0Q7hHjo0saDYLryKbeuaEQI6Co6W tyjjfn0DnBwU1wn1P8LuMZPY8m8Qcak0dFWdGJNj371i/eoGObcM/KTymIcjp3GCtTrO mbz+LYU1dtazCODNNq7MS5Inl12YtAhM8g2cRW4Jx/cih3ro6RU2wpRoswX1jUGfZ9RV 4ka1+M8/YbD1hERzk1jCrB6gx6tBprrfQ+6BE4OwEOwFk88UWdWHYOFlaYGH/YvgRpRn nuZoS4nOmfwrM9mjS7wyL+Xtxbj6gAoB62taf6955reSKD6PXQoJ+5SIDHPzHIMCtk0k c0jQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=WwrEwX4N; 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 g20-v6si32629307plq.192.2018.11.02.11.47.11; Fri, 02 Nov 2018 11:47:25 -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; dkim=pass header.i=@kernel.org header.s=default header.b=WwrEwX4N; 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 S1730363AbeKCDyc (ORCPT + 99 others); Fri, 2 Nov 2018 23:54:32 -0400 Received: from mail.kernel.org ([198.145.29.99]:50464 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729136AbeKCDyc (ORCPT ); Fri, 2 Nov 2018 23:54:32 -0400 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (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 3DE5E20837; Fri, 2 Nov 2018 18:46:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541184378; bh=GN9oKgQZ5LCixaZJZcjporTxQQPVS7A5bFzxilqf3Es=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WwrEwX4NMdDLxdlIkxQ57g1+GnCnDHuelzAhmUAyt88pgt67yMBlFF4OQ5VlLGu+8 aIsPd6fID5RrEt2hcnhhUUonabDKLg1BeEs8CD9AoBTHj0ENQAd+ThhhtXBfukLBqi 1r7+fgAGqI34FNc2PhJy82QfUKvqEp0HFln4h5DA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "David S. Miller" Subject: [PATCH 4.18 149/150] sparc: Throttle perf events properly. Date: Fri, 2 Nov 2018 19:35:11 +0100 Message-Id: <20181102182912.730367931@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181102182902.250560510@linuxfoundation.org> References: <20181102182902.250560510@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.18-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: 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; }