Re: [PATCH] user_intr: a lock to protect main_intr_queue

2020-08-05 Thread Samuel Thibault
Junling Ma, le mar. 04 août 2020 17:59:57 -0700, a ecrit: > > On Aug 4, 2020, at 5:30 PM, Samuel Thibault wrote: > > > > Junling Ma, le mar. 04 août 2020 17:08:03 -0700, a ecrit: > static user_intr_t * > search_intr (struct irqdev *dev, ipc_port_t dst_port) > { > user_intr_t

Re: [PATCH] user_intr: a lock to protect main_intr_queue

2020-08-04 Thread Junling Ma
> On Aug 4, 2020, at 5:30 PM, Samuel Thibault wrote: > > Junling Ma, le mar. 04 août 2020 17:08:03 -0700, a ecrit: static user_intr_t * search_intr (struct irqdev *dev, ipc_port_t dst_port) { user_intr_t *e; - queue_iterate (dev->intr_queue, e, user_intr_t *, chain) >>>

Re: [PATCH] user_intr: a lock to protect main_intr_queue

2020-08-04 Thread Samuel Thibault
Junling Ma, le mar. 04 août 2020 17:11:06 -0700, a ecrit: > In the next patch, we disallow deliver_user_intr from touching the queue, so > we do not need to lock it. We don't want separate patch to depend on each other. Each patch should by its own just *work* so we can test all of them one after

Re: [PATCH] user_intr: a lock to protect main_intr_queue

2020-08-04 Thread Samuel Thibault
Junling Ma, le mar. 04 août 2020 17:08:03 -0700, a ecrit: > >> static user_intr_t * > >> search_intr (struct irqdev *dev, ipc_port_t dst_port) > >> { > >> user_intr_t *e; > >> - queue_iterate (dev->intr_queue, e, user_intr_t *, chain) > >> + simple_lock(&dev->lock); > >> + queue_iterate (&dev-

Re: [PATCH] user_intr: a lock to protect main_intr_queue

2020-08-04 Thread Junling Ma
In the next patch, we disallow deliver_user_intr from touching the queue, so we do not need to lock it. In fact, by doing that, we prevent interrupts from pulling the rug under our feet, so there is no need to do splhigh/splx in irq_acknowledge and intr_thread. Junling > On Aug 4, 2020, at 4:5

Re: [PATCH] user_intr: a lock to protect main_intr_queue

2020-08-04 Thread Junling Ma
Hi Samual, > On Aug 4, 2020, at 4:51 PM, Samuel Thibault wrote: > > Junling Ma, le dim. 02 août 2020 21:04:24 -0700, a ecrit: >> -struct irqdev irqtab = { >> - "irq", irq_eoi, &main_intr_queue, 0, >> - {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, >> -}; >> +struct irqdev irqtab; >>

Re: [PATCH] user_intr: a lock to protect main_intr_queue

2020-08-04 Thread Samuel Thibault
Oh, btw, in queue_intr you also need to take the simple_lock which modifying the entry values. Samuel

Re: [PATCH] user_intr: a lock to protect main_intr_queue

2020-08-04 Thread Samuel Thibault
Junling Ma, le dim. 02 août 2020 21:04:24 -0700, a ecrit: > -struct irqdev irqtab = { > - "irq", irq_eoi, &main_intr_queue, 0, > - {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15}, > -}; > +struct irqdev irqtab; > + > +void irq_init() > +{ > + irqtab.name = "irq"; > + irqtab.irqdev_ack

[PATCH] user_intr: a lock to protect main_intr_queue

2020-08-02 Thread Junling Ma
1. The queue manipulated by two threads, the registration server and the intr_thread, so we need a lock to protect it. 2. To initialize the lock, we introduce a irq_init function in i386/i386/irq.[ch] and call it in device/device_init.c --- device/device_init.c | 3 ++- device/intr.c|