From patchwork Tue Jan 13 16:35:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Thompson X-Patchwork-Id: 43068 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f199.google.com (mail-lb0-f199.google.com [209.85.217.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F3D5C20DE8 for ; Tue, 13 Jan 2015 16:36:07 +0000 (UTC) Received: by mail-lb0-f199.google.com with SMTP id z12sf2272573lbi.2 for ; Tue, 13 Jan 2015 08:36:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=fevgrqgziR+kneyFHwE5c0/0gk0Mje9g5KMMRn6e+xI=; b=NX+Xb4bWS0vW3Skm72b8FCyfz5Y3/fjuZfmPH98TY11sg0kO90f/snqriAwItY/84x +RRZDSSZ+A1rLdHM863yxvAa4npOzS2Ei12vDf+wUqurzZoG1KXMb4DWPLpDgH9A7Vjx 6zEnQTTKt8MRjsMqtPysuXzlBIaEL7GPLEg4N99FDqVdW2pqtVfkPzOy9iBO3G6wZGX8 +NBfaplmcTG/FxPo6JhxmZZeWhy3PDEdHTY1NOby1oLbpKA46N+f3E0FfQQeYV60iP29 qhJ5+pmBisOvB9q5XbPQItBOJX9mt/r2w/K/uMGkFbz7M7YFFkjhVwlOies4rOGSyB+w 6rqQ== X-Gm-Message-State: ALoCoQmQxHCi7VhlG/dLtTlGzvnJ5HAln0c82Vbe29QWnWPRZKMQPAN54PwJlYmh8ZYVoOiIF2jq X-Received: by 10.112.9.199 with SMTP id c7mr1682848lbb.7.1421166966893; Tue, 13 Jan 2015 08:36:06 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.26.200 with SMTP id n8ls17541lag.15.gmail; Tue, 13 Jan 2015 08:36:06 -0800 (PST) X-Received: by 10.112.129.228 with SMTP id nz4mr42878433lbb.8.1421166966751; Tue, 13 Jan 2015 08:36:06 -0800 (PST) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id u1si3317356lau.102.2015.01.13.08.36.06 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Jan 2015 08:36:06 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by mail-la0-f52.google.com with SMTP id hs14so3581228lab.11 for ; Tue, 13 Jan 2015 08:36:06 -0800 (PST) X-Received: by 10.112.64.35 with SMTP id l3mr42850432lbs.82.1421166966639; Tue, 13 Jan 2015 08:36:06 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.9.200 with SMTP id c8csp1435407lbb; Tue, 13 Jan 2015 08:36:06 -0800 (PST) X-Received: by 10.180.102.38 with SMTP id fl6mr172630wib.53.1421166961867; Tue, 13 Jan 2015 08:36:01 -0800 (PST) Received: from mail-we0-f172.google.com (mail-we0-f172.google.com. [74.125.82.172]) by mx.google.com with ESMTPS id cx2si21006508wib.101.2015.01.13.08.36.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 Jan 2015 08:36:01 -0800 (PST) Received-SPF: pass (google.com: domain of daniel.thompson@linaro.org designates 74.125.82.172 as permitted sender) client-ip=74.125.82.172; Received: by mail-we0-f172.google.com with SMTP id k11so3952370wes.3 for ; Tue, 13 Jan 2015 08:36:01 -0800 (PST) X-Received: by 10.180.84.134 with SMTP id z6mr42262919wiy.50.1421166961212; Tue, 13 Jan 2015 08:36:01 -0800 (PST) Received: from sundance.lan (cpc4-aztw19-0-0-cust157.18-1.cable.virginm.net. [82.33.25.158]) by mx.google.com with ESMTPSA id q10sm26349181wjx.34.2015.01.13.08.35.59 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 Jan 2015 08:36:00 -0800 (PST) From: Daniel Thompson To: Thomas Gleixner , Jason Cooper , Russell King Cc: Daniel Thompson , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, patches@linaro.org, linaro-kernel@lists.linaro.org, John Stultz , Sumit Semwal , Dirk Behme , Daniel Drake , Dmitry Pervushin , Tim Sander , Stephen Boyd Subject: [RFC PATCH 4/5] arm: perf: Make v7 support FIQ-safe Date: Tue, 13 Jan 2015 16:35:30 +0000 Message-Id: <1421166931-14134-5-git-send-email-daniel.thompson@linaro.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1421166931-14134-1-git-send-email-daniel.thompson@linaro.org> References: <1421166931-14134-1-git-send-email-daniel.thompson@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: daniel.thompson@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , armv7pmu_disable_event() is called during irq handler. If irq handling switches over to fiq then the spin locks in this function risks deadlock. Both armv7_pmnc_disable_counter() and armv7_pmnc_disable_intens() are unconditional co-processor writes. I haven't yet come up with an schedule where other users of pmu_lock would break if interleaved with these calls so I have simply removed them. The other changed required it so avoid calling irq_work_run() when run from a FIQ handler. The pended work will either be dispatched by the irq work IPI or by a timer handler. Signed-off-by: Daniel Thompson --- arch/arm/kernel/perf_event_v7.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c index 8993770c47de..08f426486d3e 100644 --- a/arch/arm/kernel/perf_event_v7.c +++ b/arch/arm/kernel/perf_event_v7.c @@ -744,7 +744,6 @@ static void armv7pmu_enable_event(struct perf_event *event) static void armv7pmu_disable_event(struct perf_event *event) { - unsigned long flags; struct hw_perf_event *hwc = &event->hw; struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu); struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events); @@ -757,11 +756,6 @@ static void armv7pmu_disable_event(struct perf_event *event) } /* - * Disable counter and interrupt - */ - raw_spin_lock_irqsave(&events->pmu_lock, flags); - - /* * Disable counter */ armv7_pmnc_disable_counter(idx); @@ -770,8 +764,6 @@ static void armv7pmu_disable_event(struct perf_event *event) * Disable interrupt for this counter */ armv7_pmnc_disable_intens(idx); - - raw_spin_unlock_irqrestore(&events->pmu_lock, flags); } static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev) @@ -831,7 +823,8 @@ static irqreturn_t armv7pmu_handle_irq(int irq_num, void *dev) * platforms that can have the PMU interrupts raised as an NMI, this * will not work. */ - irq_work_run(); + if (!in_nmi()) + irq_work_run(); return IRQ_HANDLED; }