Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4159ybl; Tue, 7 Jan 2020 13:00:03 -0800 (PST) X-Google-Smtp-Source: APXvYqyRtlYuJ4GWKMANrmb2Mp9HB5d7zGVEr3sIYPpxjYpgH+sMnbmAKYYDdKRDyaaPI9xv6ZXg X-Received: by 2002:a05:6808:81:: with SMTP id s1mr270724oic.179.1578430803016; Tue, 07 Jan 2020 13:00:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578430803; cv=none; d=google.com; s=arc-20160816; b=BN6jm2QrhLWG/4VotUPbdIp3e1L3g0dkECQ9NYiESQ98rE7bLun6+mcdZXv/X/8hrv NIZuwUDrOlQruyYFkL0a/ThmDqnClRMfsXji+0XtgZjfV71CG8xR4txG41fuhG2nK4Oj ZcgjOaFmlAoGIkyamvxshytTeLzJN9WUxu/Nh9SUEuF7iThoXdC0S4uMQ1aUHdlvIXM3 UR36virn5fIAq6RQtYRKssPGUYTWjUSUNuSh3V/Bf307TGLCEo0xlVSC9FYu8bhYZJ5v SO4ziDV4mdSgjBmbrGY+kGiDlyl1SpIHE7PCo7ijX1CWMzcNeR91LpipNhcrcZyxaM9i rtRQ== 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=O5mEVKJ6PkgT1T7kHU5Z9RS81irlLRIG+K0G8X33CCk=; b=RjHyB7dhNFkwCsgyL90nnhXANdBlvcoq4hLxz2DJJNngv+m0iLPG6bybW2EBJrqwoB w+hh/OtBOAZmnduTiLRgUzsLx/oSU0ZD0mfN5/2NQ6kfJ2oPSDVAhQy4xdvR0CP1TGBm L1BtZ/URApyg3WfZYHMpk1nfxnv+x632jnHeDQAUn++AjnBXH+C7rR8BB2HLjwtCZw1o JCCfnoffy+WpJjNZf4Mr4ytCil4batUQjEi7FjcHNPtWgjJfqLJ/nRkdn7tXWhjNi5rF G0W3dEFaGMt8UFcydyoGxdBMvN1tyLnZ/RFH4LQa/pGN2kiDVclbD7UoMY4rx7zXphiA 1bng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vLCX3Csn; 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 h203si653884oif.3.2020.01.07.12.59.50; Tue, 07 Jan 2020 13:00:03 -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=vLCX3Csn; 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 S1727877AbgAGU61 (ORCPT + 99 others); Tue, 7 Jan 2020 15:58:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:57626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727859AbgAGU60 (ORCPT ); Tue, 7 Jan 2020 15:58:26 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 30FF42087F; Tue, 7 Jan 2020 20:58:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578430705; bh=5r1Q8nbDUxC71h9s7mcYWX05RWLrI6p1AJIXVWfWwFE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vLCX3Csn9naHKhty5kWVDfFamLIn3BPGWsUGO25L6ZnbqBEejdoPghsTOyLbW80IP 6+oXVtRaXWdqc/ZmyAtVrNmasCE169sZ9FWXKAwIwDm9iVBGHpYziEu+llFTKO8saP 3v2fdDnShuURFa8x2PwOoCDSgUv4uuCD6I3e1OJk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Thomas Richter , Vasily Gorbik , Sasha Levin Subject: [PATCH 5.4 045/191] s390/cpum_sf: Adjust sampling interval to avoid hitting sample limits Date: Tue, 7 Jan 2020 21:52:45 +0100 Message-Id: <20200107205335.404192099@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205332.984228665@linuxfoundation.org> References: <20200107205332.984228665@linuxfoundation.org> User-Agent: quilt/0.66 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 From: Thomas Richter [ Upstream commit 39d4a501a9ef55c57b51e3ef07fc2aeed7f30b3b ] Function perf_event_ever_overflow() and perf_event_account_interrupt() are called every time samples are processed by the interrupt handler. However function perf_event_account_interrupt() has checks to avoid being flooded with interrupts (more then 1000 samples are received per task_tick). Samples are then dropped and a PERF_RECORD_THROTTLED is added to the perf data. The perf subsystem limit calculation is: maximum sample frequency := 100000 --> 1 samples per 10 us task_tick = 10ms = 10000us --> 1000 samples per task_tick The work flow is measurement_alert() uses SDBT head and each SBDT points to 511 SDB pages, each with 126 sample entries. After processing 8 SBDs and for each valid sample calling: perf_event_overflow() perf_event_account_interrupts() there is a considerable amount of samples being dropped, especially when the sample frequency is very high and near the 100000 limit. To avoid the high amount of samples being dropped near the end of a task_tick time frame, increment the sampling interval in case of dropped events. The CPU Measurement sampling facility on the s390 supports only intervals, specifiing how many CPU cycles have to be executed before a sample is generated. Increase the interval when the samples being generated hit the task_tick limit. Signed-off-by: Thomas Richter Signed-off-by: Vasily Gorbik Signed-off-by: Sasha Levin --- arch/s390/kernel/perf_cpum_sf.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/arch/s390/kernel/perf_cpum_sf.c b/arch/s390/kernel/perf_cpum_sf.c index 7511b71d2931..47515c96032e 100644 --- a/arch/s390/kernel/perf_cpum_sf.c +++ b/arch/s390/kernel/perf_cpum_sf.c @@ -1325,6 +1325,22 @@ static void hw_perf_event_update(struct perf_event *event, int flush_all) if (sampl_overflow) OVERFLOW_REG(hwc) = DIV_ROUND_UP(OVERFLOW_REG(hwc) + sampl_overflow, 1 + num_sdb); + + /* Perf_event_overflow() and perf_event_account_interrupt() limit + * the interrupt rate to an upper limit. Roughly 1000 samples per + * task tick. + * Hitting this limit results in a large number + * of throttled REF_REPORT_THROTTLE entries and the samples + * are dropped. + * Slightly increase the interval to avoid hitting this limit. + */ + if (event_overflow) { + SAMPL_RATE(hwc) += DIV_ROUND_UP(SAMPL_RATE(hwc), 10); + debug_sprintf_event(sfdbg, 1, "%s: rate adjustment %ld\n", + __func__, + DIV_ROUND_UP(SAMPL_RATE(hwc), 10)); + } + if (sampl_overflow || event_overflow) debug_sprintf_event(sfdbg, 4, "hw_perf_event_update: " "overflow stats: sample=%llu event=%llu\n", -- 2.20.1