Received: by 10.223.164.202 with SMTP id h10csp1184871wrb; Tue, 7 Nov 2017 23:40:13 -0800 (PST) X-Google-Smtp-Source: ABhQp+Q3+n7pM3G6Ae2jxcJ9St200rrHPzBDbG5C2t8p5WQWhVUDzZREC7TkoyUpZj5RtUhZvBDE X-Received: by 10.98.10.153 with SMTP id 25mr1604986pfk.60.1510126813889; Tue, 07 Nov 2017 23:40:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510126813; cv=none; d=google.com; s=arc-20160816; b=R7zAnBOlQRS8QBbmNncb0nbSfDECbi67yDLc1oTMWLe+6bIaXRQ05TmN5jVQrfqC4d LiytyBDTBlrnRhXOt++WNmWXUbD2uqiygyAvbbD9Wa9wG/NqbSvvB5flMHrw/Fo37Aeb wZPSZ6rFyq5cuKLYzUiut5GgpX3Q99kYn3Kb1LH2AXLXr4gC/DNbHVG43lU+uJN5o4Mt VlzZ2RdxNMROOFeQ8HMNq4b6WrGeQbw1qAEX0Yx2Ziz1ZCFATVkwPRhT3PH4cq17ZFYz hTiZUvy7EXh7BwTgUYt8fGEcfyDGkOZExnx/fISBX7doh0PSPRzEYYx6twRnnkEhEk2F poUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:arc-authentication-results; bh=19VjAMwvLenroeLh5FintyYohOEcEw91av3mu6WW/5o=; b=I4DM1utlRXZ/eLCJJPHZvGZEK8l2uBNOEwC7S2JkfKj+TdHBVm5WiNNlMVdW+guINc gnigDtgwMfAmkA214BmKMowSpsp2thoe/jJjBqmxTzATsADMR0sVYFC+qaviWsqZoH90 DYY0TC1HniK9j8Q1p/mQAWhhQomxxoNhpHmrz+ZjxKzVKxZXwbPUaGAAGpOQls4fqpF9 ROwkSLwWtnBNmK8tcYFEfs5BYEJC/zZ03k5Fx2pdo6zavw2edbQ54+S5DMgPcDt0o+r7 3NqMeR2qyCnNWU2aIwXplBQkg6MiBeOOB0qc9RZ7Zs/5SdZIEoR3hRh5nj9L7eaUOPYW cUhg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z23si3518661pfj.257.2017.11.07.23.40.01; Tue, 07 Nov 2017 23:40:13 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756706AbdKGWOJ (ORCPT + 90 others); Tue, 7 Nov 2017 17:14:09 -0500 Received: from us01smtprelay-2.synopsys.com ([198.182.47.9]:47202 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754124AbdKGWNS (ORCPT ); Tue, 7 Nov 2017 17:13:18 -0500 Received: from mailhost.synopsys.com (mailhost3.synopsys.com [10.12.238.238]) by smtprelay.synopsys.com (Postfix) with ESMTP id 5A5B024E1514; Tue, 7 Nov 2017 14:13:18 -0800 (PST) Received: from mailhost.synopsys.com (localhost [127.0.0.1]) by mailhost.synopsys.com (Postfix) with ESMTP id 21CCE9E2; Tue, 7 Nov 2017 14:13:18 -0800 (PST) Received: from us01wehtc1.internal.synopsys.com (us01wehtc1-vip.internal.synopsys.com [10.12.239.236]) by mailhost.synopsys.com (Postfix) with ESMTP id 0FEB39E1; Tue, 7 Nov 2017 14:13:17 -0800 (PST) Received: from IN01WEHTCB.internal.synopsys.com (10.144.199.106) by us01wehtc1.internal.synopsys.com (10.12.239.231) with Microsoft SMTP Server (TLS) id 14.3.266.1; Tue, 7 Nov 2017 14:13:17 -0800 Received: from IN01WEHTCA.internal.synopsys.com (10.144.199.103) by IN01WEHTCB.internal.synopsys.com (10.144.199.105) with Microsoft SMTP Server (TLS) id 14.3.266.1; Wed, 8 Nov 2017 03:43:16 +0530 Received: from vineetg-Latitude-E7450.internal.synopsys.com (10.10.161.44) by IN01WEHTCA.internal.synopsys.com (10.144.199.243) with Microsoft SMTP Server (TLS) id 14.3.266.1; Wed, 8 Nov 2017 03:43:15 +0530 From: Vineet Gupta To: CC: , Peter Zijlstra , Vineet Gupta Subject: [PATCH 1/4] ARCv2: perf: tweak overflow interrupt Date: Tue, 7 Nov 2017 14:13:01 -0800 Message-ID: <1510092784-19942-2-git-send-email-vgupta@synopsys.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1510092784-19942-1-git-send-email-vgupta@synopsys.com> References: <1510092784-19942-1-git-send-email-vgupta@synopsys.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.10.161.44] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Current perf ISR loops thru all 32 counters, checking for each if it caused the interrupt. Instead only loop thru counters which actually interrupted (typically 1). Signed-off-by: Vineet Gupta --- arch/arc/kernel/perf_event.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/arch/arc/kernel/perf_event.c b/arch/arc/kernel/perf_event.c index 2ce24e74f879..0eaa132a2c90 100644 --- a/arch/arc/kernel/perf_event.c +++ b/arch/arc/kernel/perf_event.c @@ -377,21 +377,22 @@ static irqreturn_t arc_pmu_intr(int irq, void *dev) struct perf_sample_data data; struct arc_pmu_cpu *pmu_cpu = this_cpu_ptr(&arc_pmu_cpu); struct pt_regs *regs; - int active_ints; + unsigned int active_ints; int idx; arc_pmu_disable(&arc_pmu->pmu); active_ints = read_aux_reg(ARC_REG_PCT_INT_ACT); + if (!active_ints) + goto done; regs = get_irq_regs(); - for (idx = 0; idx < arc_pmu->n_counters; idx++) { - struct perf_event *event = pmu_cpu->act_counter[idx]; + do { + struct perf_event *event; struct hw_perf_event *hwc; - if (!(active_ints & (1 << idx))) - continue; + idx = __ffs(active_ints); /* Reset interrupt flag by writing of 1 */ write_aux_reg(ARC_REG_PCT_INT_ACT, 1 << idx); @@ -404,19 +405,22 @@ static irqreturn_t arc_pmu_intr(int irq, void *dev) write_aux_reg(ARC_REG_PCT_INT_CTRL, read_aux_reg(ARC_REG_PCT_INT_CTRL) | (1 << idx)); + event = pmu_cpu->act_counter[idx]; hwc = &event->hw; WARN_ON_ONCE(hwc->idx != idx); arc_perf_event_update(event, &event->hw, event->hw.idx); perf_sample_data_init(&data, 0, hwc->last_period); - if (!arc_pmu_event_set_period(event)) - continue; + if (arc_pmu_event_set_period(event)) { + if (perf_event_overflow(event, &data, regs)) + arc_pmu_stop(event, 0); + } - if (perf_event_overflow(event, &data, regs)) - arc_pmu_stop(event, 0); - } + active_ints &= ~(1U << idx); + } while (active_ints); +done: arc_pmu_enable(&arc_pmu->pmu); return IRQ_HANDLED; -- 2.7.4 From 1583483730652314647@xxx Wed Nov 08 07:56:04 +0000 2017 X-GM-THRID: 1583483730652314647 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread