All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Thierry Reding <thierry.reding@gmail.com>,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Dmitry Osipenko <digetx@gmail.com>,
	Sowjanya Komatineni <skomatineni@nvidia.com>,
	Venkat Reddy Talla <vreddytalla@nvidia.com>,
	kernel-team@android.com
Subject: Re: [PATCH v3 1/4] genirq/irqdomain: Allow partial trimming of irq_data hierarchy
Date: Sat, 10 Oct 2020 10:42:16 +0100	[thread overview]
Message-ID: <875z7ipgcn.wl-maz@kernel.org> (raw)
In-Reply-To: <875z7kwila.fsf@nanos.tec.linutronix.de>

On Thu, 08 Oct 2020 21:47:29 +0100,
Thomas Gleixner <tglx@linutronix.de> wrote:
> 
> On Thu, Oct 08 2020 at 14:06, Marc Zyngier wrote:
> > On 2020-10-08 12:22, Thomas Gleixner wrote:
> > Here's what I have now, with the pmc driver calling
> > irq_domain_disconnect_hierarchy() at the right spots.
> >
> >   static int irq_domain_alloc_irq_data(struct irq_domain *domain,
> > @@ -1362,11 +1442,16 @@ int __irq_domain_alloc_irqs(struct irq_domain 
> > *domain, int irq_base,
> >   		mutex_unlock(&irq_domain_mutex);
> >   		goto out_free_irq_data;
> >   	}
> > -	for (i = 0; i < nr_irqs; i++)
> > +	for (i = 0; i < nr_irqs; i++) {
> > +		ret = irq_domain_trim_hierarchy(virq + i);
> > +		if (ret)
> > +			break;
> >   		irq_domain_insert_irq(virq + i);
> 
> You can't do that in one go because in case of an error you leak the
> already inserted irqs. You need two loops.
> 
> 	for (i = 0; i < nr_irqs; i++) {
> 		ret = irq_domain_trim_hierarchy(virq + i);
> 		if (ret) {
>                 	mutex_unlock(&irq_domain_mutex);
> 			goto out_free_irq_data;
>         }
> 
> 	for (i = 0; i < nr_irqs; i++)
>    		irq_domain_insert_irq(virq + i);
> 
>   	mutex_unlock(&irq_domain_mutex);
> 	return virq;

Of course you are right. I'll fold that in.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <maz@kernel.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Venkat Reddy Talla <vreddytalla@nvidia.com>,
	linux-kernel@vger.kernel.org,
	Jonathan Hunter <jonathanh@nvidia.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	Sowjanya Komatineni <skomatineni@nvidia.com>,
	linux-tegra@vger.kernel.org, Dmitry Osipenko <digetx@gmail.com>,
	kernel-team@android.com, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v3 1/4] genirq/irqdomain: Allow partial trimming of irq_data hierarchy
Date: Sat, 10 Oct 2020 10:42:16 +0100	[thread overview]
Message-ID: <875z7ipgcn.wl-maz@kernel.org> (raw)
In-Reply-To: <875z7kwila.fsf@nanos.tec.linutronix.de>

On Thu, 08 Oct 2020 21:47:29 +0100,
Thomas Gleixner <tglx@linutronix.de> wrote:
> 
> On Thu, Oct 08 2020 at 14:06, Marc Zyngier wrote:
> > On 2020-10-08 12:22, Thomas Gleixner wrote:
> > Here's what I have now, with the pmc driver calling
> > irq_domain_disconnect_hierarchy() at the right spots.
> >
> >   static int irq_domain_alloc_irq_data(struct irq_domain *domain,
> > @@ -1362,11 +1442,16 @@ int __irq_domain_alloc_irqs(struct irq_domain 
> > *domain, int irq_base,
> >   		mutex_unlock(&irq_domain_mutex);
> >   		goto out_free_irq_data;
> >   	}
> > -	for (i = 0; i < nr_irqs; i++)
> > +	for (i = 0; i < nr_irqs; i++) {
> > +		ret = irq_domain_trim_hierarchy(virq + i);
> > +		if (ret)
> > +			break;
> >   		irq_domain_insert_irq(virq + i);
> 
> You can't do that in one go because in case of an error you leak the
> already inserted irqs. You need two loops.
> 
> 	for (i = 0; i < nr_irqs; i++) {
> 		ret = irq_domain_trim_hierarchy(virq + i);
> 		if (ret) {
>                 	mutex_unlock(&irq_domain_mutex);
> 			goto out_free_irq_data;
>         }
> 
> 	for (i = 0; i < nr_irqs; i++)
>    		irq_domain_insert_irq(virq + i);
> 
>   	mutex_unlock(&irq_domain_mutex);
> 	return virq;

Of course you are right. I'll fold that in.

Thanks,

	M.

-- 
Without deviation from the norm, progress is not possible.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-10-10 22:57 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-07 12:45 [PATCH v3 0/4] soc/tegra: Prevent the PMC driver from corrupting interrupt routing Marc Zyngier
2020-10-07 12:45 ` Marc Zyngier
2020-10-07 12:45 ` [PATCH v3 1/4] genirq/irqdomain: Allow partial trimming of irq_data hierarchy Marc Zyngier
2020-10-07 12:45   ` Marc Zyngier
2020-10-08 11:22   ` Thomas Gleixner
2020-10-08 11:22     ` Thomas Gleixner
2020-10-08 13:06     ` Marc Zyngier
2020-10-08 13:06       ` Marc Zyngier
2020-10-08 20:47       ` Thomas Gleixner
2020-10-08 20:47         ` Thomas Gleixner
2020-10-10  9:42         ` Marc Zyngier [this message]
2020-10-10  9:42           ` Marc Zyngier
2020-10-07 12:45 ` [PATCH v3 2/4] gpio: tegra186: Allow optional irq parent callbacks Marc Zyngier
2020-10-07 12:45   ` Marc Zyngier
2020-10-07 12:45 ` [PATCH v3 3/4] soc/tegra: pmc: " Marc Zyngier
2020-10-07 12:45   ` Marc Zyngier
2020-10-07 12:45 ` [PATCH v3 4/4] soc/tegra: pmc: Don't create fake interrupt hierarchy levels Marc Zyngier
2020-10-07 12:45   ` Marc Zyngier

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=875z7ipgcn.wl-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=digetx@gmail.com \
    --cc=jonathanh@nvidia.com \
    --cc=kernel-team@android.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=skomatineni@nvidia.com \
    --cc=tglx@linutronix.de \
    --cc=thierry.reding@gmail.com \
    --cc=vreddytalla@nvidia.com \
    /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.