From: Thomas Gleixner <tglx@linutronix.de>
To: Qais Yousef <qais.yousef@imgtec.com>
Cc: linux-kernel@vger.kernel.org, jason@lakedaemon.net,
marc.zyngier@arm.com, jiang.liu@linux.intel.com,
ralf@linux-mips.org, linux-mips@linux-mips.org
Subject: Re: [RFC v2 PATCH 07/14] irq: add a new generic IPI reservation code to irq core
Date: Tue, 13 Oct 2015 15:37:30 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.11.1510131531290.25029@nanos> (raw)
In-Reply-To: <1444731382-19313-8-git-send-email-qais.yousef@imgtec.com>
On Tue, 13 Oct 2015, Qais Yousef wrote:
> +/**
> + * irq_reserve_ipi() - setup an IPI to destination cpumask
> + * @domain: IPI domain
> + * @dest: cpumask of cpus to receive the IPI
> + *
> + * Allocate a virq that can be used to send IPI to any CPU in dest mask.
> + *
> + * On success it'll return linux irq number and 0 on failure
> + */
> +unsigned int irq_reserve_ipi(struct irq_domain *domain,
> + const struct ipi_mask *dest)
> +{
> + struct irq_data *data;
> + int virq;
> + unsigned int nr_irqs;
Please order them so:
+ struct irq_data *data;
+ unsigned int nr_irqs;
+ int virq;
Much simpler to read.
> + if (domain == NULL)
> + domain = irq_default_domain; /* need a separate ipi_default_domain? */
No tail comments please.
We should neither use irq_default_domain nor have an
ipi_default_domain.
> +
> + if (domain == NULL) {
> + pr_warn("Must provide a valid IPI domain!\n");
> + return 0;
> + }
> +
> + if (!irq_domain_is_ipi(domain)) {
> + pr_warn("Not an IPI domain!\n");
> + return 0;
> + }
> +
> + /* always allocate a virq per cpu */
> + nr_irqs = bitmap_weight(dest->cpumask, dest->nbits);;
Double semicolon
> +
> + virq = irq_domain_alloc_descs(-1, nr_irqs, 0, NUMA_NO_NODE);
> + if (virq <= 0) {
> + pr_warn("Can't reserve IPI, failed to alloc descs\n");
> + return 0;
> + }
> +
> + /* we are reusing hierarchy alloc function, should we create another one? */
> + virq = __irq_domain_alloc_irqs(domain, virq, nr_irqs, NUMA_NO_NODE,
> + (void *) dest, true);
> + if (virq <= 0) {
> + pr_warn("Can't reserve IPI, failed to alloc irqs\n");
> + goto free_descs;
> + }
> +
> + data = irq_get_irq_data(virq);
> + bitmap_copy(data->ipi_mask.cpumask, dest->cpumask, dest->nbits);
> + data->ipi_mask.nbits = dest->nbits;
This does only initialize the first virq data. What about the others?
> + return virq;
> +
> +free_descs:
> + irq_free_descs(virq, nr_irqs);
> + return 0;
> +}
> +
> +/**
> + * irq_destroy_ipi() - unreserve an IPI that was previously allocated
> + * @irq: linux irq number to be destroyed
> + *
> + * Return an IPI allocated with irq_reserve_ipi() to the system.
That wants to explain that it actually destroys a number of virqs not
just the primary one.
Thanks,
tglx
next prev parent reply other threads:[~2015-10-13 13:38 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-13 10:16 [RFC v2 PATCH 00/14] Implement generic IPI support mechanism Qais Yousef
2015-10-13 10:16 ` [RFC v2 PATCH 01/14] irq: add new IRQ_DOMAIN_FLAGS_IPI Qais Yousef
2015-10-13 10:16 ` [RFC v2 PATCH 02/14] irq: add GENERIC_IRQ_IPI Kconfig symbol Qais Yousef
2015-10-13 10:16 ` [RFC v2 PATCH 03/14] irq: add new struct ipi_mask Qais Yousef
2015-10-13 13:26 ` Thomas Gleixner
2015-10-13 14:26 ` Qais Yousef
2015-10-13 10:16 ` [RFC v2 PATCH 04/14] irq: add a new irq_send_ipi() to irq_chip Qais Yousef
2015-10-13 10:16 ` [RFC v2 PATCH 05/14] irq: add struct ipi_mask to irq_data Qais Yousef
2015-10-13 12:36 ` kbuild test robot
2015-10-14 14:50 ` Davidlohr Bueso
2015-10-14 15:46 ` Qais Yousef
2015-10-13 10:16 ` [RFC v2 PATCH 06/14] irq: add struct ipi_mapping and its helper functions Qais Yousef
2015-10-13 13:31 ` Thomas Gleixner
2015-10-13 14:30 ` Qais Yousef
2015-10-13 10:16 ` [RFC v2 PATCH 07/14] irq: add a new generic IPI reservation code to irq core Qais Yousef
2015-10-13 10:56 ` kbuild test robot
2015-10-13 10:56 ` kbuild test robot
2015-10-13 13:37 ` Thomas Gleixner [this message]
2015-10-13 14:38 ` Qais Yousef
2015-10-28 15:46 ` Qais Yousef
2015-10-29 10:39 ` Qais Yousef
2015-10-13 10:16 ` [RFC v2 PATCH 08/14] irq: implement irq_send_ipi Qais Yousef
2015-10-13 11:12 ` kbuild test robot
2015-10-13 11:29 ` kbuild test robot
2015-10-13 13:40 ` Thomas Gleixner
2015-10-13 14:41 ` Qais Yousef
2015-10-13 10:16 ` [RFC v2 PATCH 09/14] MIPS: add support for generic SMP IPI support Qais Yousef
2015-10-13 13:48 ` Thomas Gleixner
2015-10-13 14:43 ` Qais Yousef
2015-10-13 10:16 ` [RFC v2 PATCH 10/14] MIPS: make smp CMP, CPS and MT use the new generic IPI functions Qais Yousef
2015-10-13 13:49 ` Thomas Gleixner
2015-10-13 14:46 ` Qais Yousef
2015-10-13 10:16 ` [RFC v2 PATCH 11/14] MIPS: delete smp-gic.c Qais Yousef
2015-10-13 10:16 ` [RFC v2 PATCH 12/14] irqchip: mips-gic: add a IPI hierarchy domain Qais Yousef
2015-10-13 10:16 ` [RFC v2 PATCH 13/14] irqchip: mips-gic: implement the new irq_send_ipi Qais Yousef
2015-10-13 10:16 ` [RFC v2 PATCH 14/14] irqchip: mips-gic: remove IPI init code Qais Yousef
2015-10-13 13:53 ` [RFC v2 PATCH 00/14] Implement generic IPI support mechanism Thomas Gleixner
2015-10-13 14:48 ` Qais Yousef
2015-10-13 17:24 ` Sergei Shtylyov
2015-10-13 17:27 ` Thomas Gleixner
2015-10-14 15:04 ` Davidlohr Bueso
2015-10-14 15:49 ` Qais Yousef
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=alpine.DEB.2.11.1510131531290.25029@nanos \
--to=tglx@linutronix.de \
--cc=jason@lakedaemon.net \
--cc=jiang.liu@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=marc.zyngier@arm.com \
--cc=qais.yousef@imgtec.com \
--cc=ralf@linux-mips.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).