lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZNDwtMJmhk9pP3Nq@FVFF77S0Q05N.cambridge.arm.com>
Date:   Mon, 7 Aug 2023 14:25:08 +0100
From:   Mark Rutland <mark.rutland@....com>
To:     Sumit Garg <sumit.garg@...aro.org>
Cc:     Douglas Anderson <dianders@...omium.org>,
        Marc Zyngier <maz@...nel.org>,
        Catalin Marinas <catalin.marinas@....com>,
        Will Deacon <will@...nel.org>,
        Daniel Thompson <daniel.thompson@...aro.org>,
        linux-perf-users@...r.kernel.org, ito-yuichi@...itsu.com,
        Chen-Yu Tsai <wens@...e.org>, Ard Biesheuvel <ardb@...nel.org>,
        Stephen Boyd <swboyd@...omium.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        linux-arm-kernel@...ts.infradead.org,
        kgdb-bugreport@...ts.sourceforge.net,
        Masayoshi Mizuma <msys.mizuma@...il.com>,
        "Rafael J . Wysocki" <rafael.j.wysocki@...el.com>,
        Lecopzer Chen <lecopzer.chen@...iatek.com>,
        Masayoshi Mizuma <m.mizuma@...fujitsu.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v9 1/7] irqchip/gic-v3: Enable support for SGIs to act as
 NMIs

On Mon, Aug 07, 2023 at 04:52:40PM +0530, Sumit Garg wrote:
> On Mon, 7 Aug 2023 at 15:20, Mark Rutland <mark.rutland@....com> wrote:
> > On Thu, Jun 01, 2023 at 02:31:45PM -0700, Douglas Anderson wrote:
> > > @@ -542,16 +543,22 @@ static int gic_irq_nmi_setup(struct irq_data *d)
> > >               return -EINVAL;
> > >
> > >       /* desc lock should already be held */
> > > -     if (gic_irq_in_rdist(d)) {
> > > -             u32 idx = gic_get_ppi_index(d);
> > > +     switch (get_intid_range(d)) {
> > > +     case SGI_RANGE:
> > > +             break;
> > > +     case PPI_RANGE:
> > > +     case EPPI_RANGE:
> > > +             idx = gic_get_ppi_index(d);
> > >
> > >               /* Setting up PPI as NMI, only switch handler for first NMI */
> > >               if (!refcount_inc_not_zero(&ppi_nmi_refs[idx])) {
> > >                       refcount_set(&ppi_nmi_refs[idx], 1);
> > >                       desc->handle_irq = handle_percpu_devid_fasteoi_nmi;
> > >               }
> > > -     } else {
> > > +             break;
> > > +     default:
> > >               desc->handle_irq = handle_fasteoi_nmi;
> > > +             break;
> > >       }
> >
> > As above, I reckon this isn't right, and we should treat all rdist interrupts
> > (which are all percpu) the same.
> >
> > I reckon what we should be doing here is make ppi_nmi_refs cover all of the
> > rdist interrupts (e.g. make that rdist_nmi_refs, add a gic_get_rdist_idx()
> > helper), and then here have something like:
> >
> >         if (gic_irq_in_rdist(d)) {
> >                 u32 idx = gic_get_rdist_idx(d);
> >
> >                 /*
> >                  * Setting up a percpu interrupt as NMI, only switch handler
> >                  * for first NMI
> >                  */
> >                 if (!refcount_inc_not_zero(&rdist_nmi_refs[idx])) {
> >                         refcount_set(&ppi_nmi_refs[idx], 1);
> >                         desc->handle_irq = handle_percpu_devid_fasteoi_nmi;
> >                 }
> >         }
> 
> It looks like you missed the else part here as follows for all other
> interrupt types:
> 
>          } else {
>                  desc->handle_irq = handle_fasteoi_nmi;
>          }

Yes, sorry; I had meant for that to be included, i.e.

	if (gic_irq_in_rdist(d)) {
		u32 idx = gic_get_rdist_idx(d);

		/*
		 * Setting up a percpu interrupt as NMI, only switch handler
		 * for first NMI
		 */
		if (!refcount_inc_not_zero(&rdist_nmi_refs[idx])) {
			refcount_set(&ppi_nmi_refs[idx], 1);
			desc->handle_irq = handle_percpu_devid_fasteoi_nmi;
		}
	} else {
		desc->handle_irq = handle_fasteoi_nmi;
	}

> Apart from that, your logic sounds good to me.

Great!

Thanks,
Mark.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ