Re: [PATCH] Move user_intr handling to mach side

2020-08-04 Thread Junling Ma
> On Aug 4, 2020, at 5:24 PM, Samuel Thibault wrote: > > Re, > > Junling Ma, le dim. 02 août 2020 21:07:00 -0700, a ecrit: >> +struct pt_regs; >> +extern int request_irq (unsigned int irq, void (*handler) (int, void *, >> struct pt_regs *), >> +

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; >&g

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,

Re: [PATCH] irqdev: remove tot_num_intr

2020-08-04 Thread Junling Ma
these two device_* called that are only meant for the irq device. Best, Junling > On Aug 4, 2020, at 3:58 PM, Samuel Thibault wrote: > > Junling Ma, le mar. 04 août 2020 14:47:09 -0700, a ecrit: >> The tot_num_intr field is a count of how many deliverable interrupts across >&g

Re: [PATCH] irqdev: remove tot_num_intr

2020-08-04 Thread Junling Ma
Hi Jess, > On Aug 4, 2020, at 3:22 PM, Jessica Clarke wrote: > > On 4 Aug 2020, at 22:47, Junling Ma wrote: >> >> The tot_num_intr field is a count of how many deliverable interrupts across >> all lines. When we move >> to the scheme of blocking read for re

[PATCH] irqdev: search_intr with interrupt line

2020-08-04 Thread Junling Ma
In the read/write irq scheme, a program may open multiple irq devices. When wrting (acking), we need to find the user_intr_t that both points to the device port and has the correct interrupt. Thus the search_intr function need to match the interrupt id. For the device_intr_ack method, the id p

[PATCH] irqdev: remove tot_num_intr

2020-08-04 Thread Junling Ma
The tot_num_intr field is a count of how many deliverable interrupts across all lines. When we move to the scheme of blocking read for request and write for acking, it is possible that an interrupt can happen during a small period that the interrupt is acked, but the read has not happended yet.

[PATCH v2] linux irq: remove suer_intr from linux_action

2020-08-04 Thread Junling Ma
linux irq: remove suer_intr from linux_action --- linux/dev/arch/i386/kernel/irq.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/linux/dev/arch/i386/kernel/irq.c b/linux/dev/arch/i386/kernel/irq.c index aee10462..de7d6c6a 100644 --- a/linux/dev/arch/i386/kernel/irq.c +++ b/linux/

[PATCH v2] irqdev: make deliver_user_intr a linux irq handler

2020-08-04 Thread Junling Ma
irqdev: make deliver_user_intr a linux irq handler --- device/intr.c| 30 ++- device/intr.h| 1 - linux/dev/arch/i386/kernel/irq.c | 51 +--- 3 files changed, 24 insertions(+), 58 deletions(-) diff --git a/devic

[PATCH v2] irqdev: make deliver_user_intr return void

2020-08-04 Thread Junling Ma
This sets up the stage for making deliver_user_intr a linux irq handler, which does not have a return value. So we make deliver_user_intr return void, and move the check for dead notification port into intr_thread. Now deliver_user_intr does not touch main_intr_queue, and only the server thread

[PATCH] Move user_intr handling to mach side

2020-08-02 Thread Junling Ma
1. make deliver_intr a linux irq handler, and do not let it touch the main_intr_queue. the queue handling is solely in intr_thread (removing dead entries) and insert_intr_entry (insertion). 2. remove user_intr from struct linux_action and its handling on linux side. --- device/intr.c

[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|

Re: [PATCH-1] A new irq device interface

2020-08-02 Thread Junling Ma
Ok. Will do. Junling > On Aug 2, 2020, at 4:52 PM, Samuel Thibault wrote: > > Junling Ma, le dim. 02 août 2020 16:45:22 -0700, a ecrit: >> I guess you misunderstood what I mean. I mean that there seems to be no >> interest in the discussion on IRC yesterday that we i

Re: [PATCH-1] A new irq device interface

2020-08-02 Thread Junling Ma
series of revised patch for that. Junling > On Aug 2, 2020, at 4:33 PM, Samuel Thibault wrote: > > Junling Ma, le dim. 02 août 2020 16:19:39 -0700, a ecrit: >> I was distracted by using a counter at all in the original code, >> because an irq cannot be fired more than on

Re: [PATCH-1] A new irq device interface

2020-08-02 Thread Junling Ma
> On Aug 2, 2020, at 3:44 PM, Samuel Thibault wrote: > > Junling Ma, le dim. 02 août 2020 15:32:01 -0700, a ecrit: >>>> 1. Change devicer_user_intr to be a linux interrupt handler. >>> >>> Right, this makes sense, but did you actually try it? Check the

Re: [PATCH-1] A new irq device interface

2020-08-02 Thread Junling Ma
Hi Samual, Thanks for reviewing. > Junling Ma, le sam. 01 août 2020 18:59:58 -0700, a ecrit: >> PATCH 1 is included in this email: it prepares the stage by > > Please provide separate patches for each over these. Otherwise this is > all conflated and way more difficult to r

[PATCH-3] A new irq device interface

2020-08-01 Thread Junling Ma
In this patch, the old interface of device_intr_register and device_intr_ack is removed. Junling Ma --- Makefrag.am| 2 - device/ds_routines.c | 62 -- device/intr.c | 104 - device/intr.h

[PATCH-2] A new irq device interface -- resend in plain text

2020-08-01 Thread Junling Ma
Sorry the previous PATCH-2 was not in plain text. Here is a resend. — Hi all, In this patch, the new interface of irq device is implemented. Please see the first patch for a description. Junling Ma --- device/ds_routines.c | 2 +- device/intr.c| 184

[PATCH-2] A new irq device interface

2020-08-01 Thread Junling Ma
Hi all, In this patch, the new interface of irq device is implemented. Please see the first patch for a description. Junling Ma --- device/ds_routines.c | 2 +- device/intr.c| 184 +-- device/intr.h| 11 ++- i386/i386at/conf.c | 4

[PATCH-1] A new irq device interface

2020-08-01 Thread Junling Ma
represent a specific interrupt line, so that notifications queue on each line. 3. Make struct irqdev store a vector user_intr_t, indexed by interrupt line. 4. The n_unacked counter only increases when successfully delivered an interrupt. Any comments? Best, Junling Ma --- device/device_init.c