rough-draft VKERNEL host-initiated shutdown patch

Matthew Dillon dillon at apollo.backplane.com
Sun May 20 15:00:56 PDT 2007


:Disclaimer: MESSY!
:
:Took a quick attempt at getting the VKERNEL to shutdown cleanly against
:1.8,
:and it seems to work just fine as suggested with mailbox signals, etc.
:
:Attached is my 'cumulative' 1.8 vkernel patch against 1.8_Release
:/usr/src/sys/platform/vkernel including the previous multi-vk changes.
:...
:status:
:   - OK for simple shutdown case with init already fork()'ed.

    Looks good.

:   - VK is too fast for me to catch the 'no init yet' shutdown case..
    
    Heh.

:   - need to merge against Preview, as things have changed there,
:     and re-submit. patch here includes previous multivkd work.

    Yup, I was just going to say that... multi-vk is already in HEAD.

:changes in:
:  - platform/vkernel/include/globaldata.h : maibox slot
:  - platform/vkernel/include/md_var.h : vk_shutdown prototype
:  - platform/vkernel/platform/kqueue.c : mailbox hook
:  - platform/vkernel/platform/init.c : vk_shutdown function
:
:questions/notes:
:  - I didn't think I really needed a separate sigaction in
:    kqueue_setup..
:  - should shutdown mailbox handler dispatch happen higher up
:    (e.g. in platform/vkernel/i386/trap.c)
:  - should this actually follow
:    'vke_intr(void *xsc, struct intrframe *frame __unused)' conventions?
:    - we're not really checking for FD related IO kevents() ..
:    - this implies a more 'full device' kind of thing , with a struct,
:      etc.

    The sigaction initialization for SIGTERM doesn't really belong
    in init_kqueue().  Put it in platform/vkernel/i386/exception.c
    instead.

    Now the question is: should it be a signal mailbox or a real signal?

    That's a good question.  Well, we have an issue with the small size
    of the kernel thread stack, so I think it should be a mailbox.

    Now... when to check for and call the function!  There are two places
    where it needs to be checked:

    (1) in go_user().
    (2) in cpu_idle().

    Check for the mailbox and call a function specific to the shutdown
    (which you can also put in platform/vkernel/i386/exception.c).  Don't
    integrate it into signalmailbox().

:  - should the other init(8) signals for e.g. single user, etc. be
:    implemented? Currently, these are not implement as shutdown is
:    ~90% of cases, and wanted to verify I'm taking the proper direction.

    single-user mode on the master host will send a HUP or a TERM
    (I forget which) to all processes, including the vkernel.  They
    should probably be treated as a shutdown by the vkernel.

:  - mailbox signals aren't really documented in the manual at the
:    moment..

    I'll do a quick fix to the sigaction manual page.  hmm.  I thought
    I had documented it.

:Comments / Questions / feedback welcome.
:
:Thanks!
:
:  - Chris





More information about the Submit mailing list