All of lore.kernel.org
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/5] arm_pmu: have armpmu_alloc() take GFP flags
Date: Mon, 11 Dec 2017 17:37:02 +0000	[thread overview]
Message-ID: <20171211173702.GC3275@arm.com> (raw)
In-Reply-To: <20171101141239.45340-3-mark.rutland@arm.com>

On Wed, Nov 01, 2017 at 02:12:36PM +0000, Mark Rutland wrote:
> In ACPI systems, we don't know the makeup of CPUs until we hotplug them
> on, and thus have to allocate the PMU datastrcutures at hotplug time.
> Thus, we must use GFP_ATOMIC allocations.
> 
> Reorganise the PMU allocators to take a GFP argument so that we can
> permit this.
> 
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> Cc: Will Deacon <will.deacon@arm.com>
> ---
>  drivers/perf/arm_pmu.c          | 6 +++---
>  drivers/perf/arm_pmu_acpi.c     | 2 +-
>  drivers/perf/arm_pmu_platform.c | 2 +-
>  include/linux/perf/arm_pmu.h    | 2 +-
>  4 files changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
> index 57df8dce8e19..3d6d4c5f2356 100644
> --- a/drivers/perf/arm_pmu.c
> +++ b/drivers/perf/arm_pmu.c
> @@ -779,18 +779,18 @@ static void cpu_pmu_destroy(struct arm_pmu *cpu_pmu)
>  					    &cpu_pmu->node);
>  }
>  
> -struct arm_pmu *armpmu_alloc(void)
> +struct arm_pmu *armpmu_alloc(gfp_t flags)
>  {
>  	struct arm_pmu *pmu;
>  	int cpu;
>  
> -	pmu = kzalloc(sizeof(*pmu), GFP_KERNEL);
> +	pmu = kzalloc(sizeof(*pmu), flags);
>  	if (!pmu) {
>  		pr_info("failed to allocate PMU device!\n");
>  		goto out;
>  	}
>  
> -	pmu->hw_events = alloc_percpu(struct pmu_hw_events);
> +	pmu->hw_events = alloc_percpu_gfp(struct pmu_hw_events, flags);
>  	if (!pmu->hw_events) {
>  		pr_info("failed to allocate per-cpu PMU data.\n");
>  		goto out_free_pmu;
> diff --git a/drivers/perf/arm_pmu_acpi.c b/drivers/perf/arm_pmu_acpi.c
> index 705f1a390e31..a52f5b673a15 100644
> --- a/drivers/perf/arm_pmu_acpi.c
> +++ b/drivers/perf/arm_pmu_acpi.c
> @@ -127,7 +127,7 @@ static struct arm_pmu *arm_pmu_acpi_find_alloc_pmu(void)
>  		return pmu;
>  	}
>  
> -	pmu = armpmu_alloc();
> +	pmu = armpmu_alloc(GFP_ATOMIC);

I think I'd rather have armpmu_alloc_atomic as a wrapper around
__armpmu_alloc(GFP_ATOMIC) and then leave the armpmu_alloc to pass
GFP_KERNEL.

Will

  parent reply	other threads:[~2017-12-11 17:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-01 14:12 [PATCH 0/5] arm_pmu: fix lockdep issues with ACPI systems Mark Rutland
2017-11-01 14:12 ` [PATCH 1/5] arm_pmu: fold platform helpers into platform code Mark Rutland
2017-11-01 14:12 ` [PATCH 2/5] arm_pmu: have armpmu_alloc() take GFP flags Mark Rutland
2017-12-06  6:54   ` Zhangshaokun
2017-12-11 17:37   ` Will Deacon [this message]
2017-12-11 18:02     ` Mark Rutland
2017-11-01 14:12 ` [PATCH 3/5] arm_pmu: acpi: check for mismatched PPIs Mark Rutland
2017-12-11 17:37   ` Will Deacon
2017-12-11 18:08     ` Mark Rutland
2017-12-11 18:43       ` Will Deacon
2017-11-01 14:12 ` [PATCH 4/5] arm_pmu: note IRQs/PMUs per-cpu Mark Rutland
2017-12-11 17:36   ` Will Deacon
2017-12-11 18:15     ` Mark Rutland
2017-11-01 14:12 ` [PATCH 5/5] arm_pmu: acpi: request IRQs up-front Mark Rutland
2017-12-11 17:36   ` Will Deacon
2017-12-11 17:55     ` Mark Rutland
2017-12-11 18:45       ` Will Deacon
2017-11-01 17:02 ` [PATCH 0/5] arm_pmu: fix lockdep issues with ACPI systems Tyler Baicar
2017-12-11 17:38 ` Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171211173702.GC3275@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.