Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1232910ybt; Thu, 18 Jun 2020 03:56:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwl2wL1K6JpOArIZzd4ahQlabYG0kBd5JLP6KU+4ngk3mfL1hGabWbej3s1oQCAhdh8iz+V X-Received: by 2002:a17:906:5250:: with SMTP id y16mr3362509ejm.3.1592477760315; Thu, 18 Jun 2020 03:56:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592477760; cv=none; d=google.com; s=arc-20160816; b=lQdKQtW3Q/ZYgznGn9gMIO6Y9ivgG8K+T04Cegaz+qIjpbGuME1WpiF/sDfVxI0QEF BL6l6zpm2cL7b0lWYcqemvvAeTV/6WbdAaDkwZIyXY0noRqQ9OalSJUXRbu3jvs65aNv nrX3kUX1NxEIQIeLtqWUVJY0CRSQxyyX5H+41A07jiFT/dHFQi5a+xYQ0XV86wQeI1h4 Q3X+TJ04fkVCrV3hWfLFog5QaZ92kfLSIJrvcFpoipze+nvrHCy7Mx1SinRc+xLJT5TX mmqrToWsrHhpUgtkTdtB/YaBM3H6YABL1Kv6yRckKMuA84zAOHDQS3Vhw7DXkDYV4q4V /v1Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=Y63N/9ESHZBNmfOgS/JGrbc5rH/sVmfd6b6kjkws66g=; b=UW1kPNb6cOAWM9FqnLpDYYWnCzkadnY+0nn2jy1iyTVn/2OZSYhxEiggWU3GnRSxRp MpEfewA4BkUqAkaosaSC+1mkyrC2DYLJxK0IQQmnM245CUV/Okv+8t9ELaNdUyRlFw6z ElELHNFHaRzeKbuVV9//1l9RDtE+WBalmnkTjfr7P2pP2btMFcnGQ55azJMbT5fmivsp 04VXkN/Tb4cgRhxhkMwQdIrSGoz3kzkbZV8qFJ1JtqPIU1Cwct6Fojj9dv59WOCgXqJm f/NXJS++ZAHUPzqT8dkFiqkf1LosMgbhi9MgpOZGRO4d6cPQxH5psol7cWin4NhW8qyq XFDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e1si1622166ejd.353.2020.06.18.03.55.36; Thu, 18 Jun 2020 03:56:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729410AbgFRKul (ORCPT + 99 others); Thu, 18 Jun 2020 06:50:41 -0400 Received: from foss.arm.com ([217.140.110.172]:47940 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729369AbgFRKuj (ORCPT ); Thu, 18 Jun 2020 06:50:39 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id BAAFA31B; Thu, 18 Jun 2020 03:50:38 -0700 (PDT) Received: from [192.168.0.110] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7EA903F71F; Thu, 18 Jun 2020 03:50:37 -0700 (PDT) Subject: Re: [PATCH v5 6/7] arm_pmu: Introduce pmu_irq_ops To: Stephen Boyd , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: mark.rutland@arm.com, Julien Thierry , maz@kernel.org, Will Deacon , catalin.marinas@arm.com, will@kernel.org, Julien Thierry References: <20200617113851.607706-1-alexandru.elisei@arm.com> <20200617113851.607706-7-alexandru.elisei@arm.com> <159242539231.62212.11549121838391298623@swboyd.mtv.corp.google.com> From: Alexandru Elisei Message-ID: <8db25400-5a01-18f6-d362-af3ad229361a@arm.com> Date: Thu, 18 Jun 2020 11:51:24 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.9.0 MIME-Version: 1.0 In-Reply-To: <159242539231.62212.11549121838391298623@swboyd.mtv.corp.google.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 6/17/20 9:23 PM, Stephen Boyd wrote: > Quoting Alexandru Elisei (2020-06-17 04:38:50) >> diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c >> index df352b334ea7..17e5952d21e4 100644 >> --- a/drivers/perf/arm_pmu.c >> +++ b/drivers/perf/arm_pmu.c >> @@ -26,8 +26,46 @@ >> >> #include >> >> +static int armpmu_count_irq_users(const int irq); >> + >> +struct pmu_irq_ops { >> + void (*enable_pmuirq)(unsigned int irq); >> + void (*disable_pmuirq)(unsigned int irq); >> + void (*free_pmuirq)(unsigned int irq, int cpu, void __percpu *devid); > Does 'cpu' need to be signed? I'm not sure what you mean. The cpu argument comes from drivers/perf/arm_pmu_platform.c::armpmu_free_irqs -> arpmu_free_irq, where is the iterator variable used by the macro for_each_cpu. The documentation for the macro states: /** * for_each_cpu - iterate over every cpu in a mask * @cpu: the (optionally unsigned) integer iterator ^^^^^^^^^^^^^^^^^^^ I could write a patch to convert to an unsigned int, but it seems like unnecessary churn to me. >> +}; >> + >> +static void armpmu_free_pmuirq(unsigned int irq, int cpu, void __percpu *devid) >> +{ >> + free_irq(irq, per_cpu_ptr(devid, cpu)); >> +} >> + >> +static const struct pmu_irq_ops pmuirq_ops = { >> + .enable_pmuirq = enable_irq, >> + .disable_pmuirq = disable_irq_nosync, >> + .free_pmuirq = armpmu_free_pmuirq >> +}; >> + >> +static void armpmu_enable_percpu_pmuirq(unsigned int irq) >> +{ >> + enable_percpu_irq(irq, IRQ_TYPE_NONE); >> +} >> + >> +static void armpmu_free_percpu_pmuirq(unsigned int irq, int cpu, >> + void __percpu *devid) >> +{ >> + if (armpmu_count_irq_users(irq) == 1) >> + free_percpu_irq(irq, devid); >> +} >> + >> +static const struct pmu_irq_ops percpu_pmuirq_ops = { >> + .enable_pmuirq = armpmu_enable_percpu_pmuirq, >> + .disable_pmuirq = disable_percpu_irq, >> + .free_pmuirq = armpmu_free_percpu_pmuirq >> +}; >> + >> static DEFINE_PER_CPU(struct arm_pmu *, cpu_armpmu); >> static DEFINE_PER_CPU(int, cpu_irq); > Same question as above. Same situation as above - cpu is the iterator variable for for_each_cpu. Thanks, Alex