Port-amd64 archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: shrink ci_ilevel from 32 to 8 bits ?

On Sun, Apr 12, 2020 at 08:52:54AM +0200, Jaromír Dole?ek wrote:
> Le sam. 11 avr. 2020 à 22:25, Manuel Bouyer <bouyer%antioche.eu.org@localhost> a écrit :
> > So I'ld like to change ci_istate to
> >        struct {
> >                uint32_t        ipending;
> >                int8_t          ilevel;
> >                uint8_t         xpending;
> >                int16_t         ipad; /* free bits for futur use */
> >                uint32_t        imasked;
> >        } ci_istate __aligned(8);
> A while ago there was talk that it would be nice to expand ipending to
> allow more native interrupts per CPU, which also involved shrinking
> ilevel to int8_t and reusing the extra space. I started on that, but
> never finished.
> So this helps with that eventually too. It will be easier to adapt and
> reuse the remaining space for native interrupts since ilevel handling
> would be out of the way already by your change.

after a night I could see that Xen could use the fast software interrupt
setip for its need (just register software interrupts for IPL_VM, IPL_SCHED
and IPL_HIGH). So I went this way and could get rid of the Xen-specific
interrupt handlings in cpu_info and simplify the assembly functions.

Now, this use another 3 slots in ipending when running Xen.
so I would change my proposal to use a 8-bit word for software
interrupts. This could also fix this issue noted in intrdefs.h:
 * XXX These should be lowest numbered, but right now would
 * conflict with the legacy IRQs.  Their current position
 * means that soft interrupt take priority over hardware
 * interrupts when lowering the priority level!

This would free 4 slots from ipending.
So I propose to change ci_istate to
       struct {
               uint32_t        ipending; /* pending hardware interrupts */
               int8_t          ilevel; /* current SPL */
               uint8_t         sipending; /* pending software interrupts */
               int16_t         ipad; /* free bits for futur use */
               uint32_t        imasked; /* masked hardware interrupts */
       } ci_istate __aligned(8);

and associated ci_isources[], ci_simask[] and ci_siunmask[]

If nobody objects I'll start working on this.

Unless I have a better idea tomorow :)

Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference

Home | Main Index | Thread Index | Old Index