From: Sasha Levin <levinsasha928@gmail.com>
To: Pekka Enberg <penberg@cs.helsinki.fi>
Cc: kvm@vger.kernel.org, mingo@elte.hu, asias.hejun@gmail.com,
gorcunov@gmail.com
Subject: Re: [PATCH] kvm tools: Add method to stop ipc thread
Date: Tue, 25 Oct 2011 13:27:19 +0200 [thread overview]
Message-ID: <1319542039.3816.20.camel@lappy> (raw)
In-Reply-To: <CAOJsxLE9iAdR3gB67CJ8PO6C26K=pravMtsTU=eMuY6pbL+z4Q@mail.gmail.com>
On Tue, 2011-10-25 at 13:42 +0300, Pekka Enberg wrote:
> On Tue, Oct 25, 2011 at 1:40 PM, Sasha Levin <levinsasha928@gmail.com> wrote:
> > Stop the ipc thread when shutting down the hypervisor.
> >
> > This solves a bug where the .sock files weren't removed upon shutdown.
> >
> > Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> > ---
> > tools/kvm/include/kvm/kvm-ipc.h | 1 +
> > tools/kvm/kvm-ipc.c | 33 +++++++++++++++++++++++++++++----
> > tools/kvm/kvm.c | 1 +
> > 3 files changed, 31 insertions(+), 4 deletions(-)
> >
> > diff --git a/tools/kvm/include/kvm/kvm-ipc.h b/tools/kvm/include/kvm/kvm-ipc.h
> > index c932052..731767f 100644
> > --- a/tools/kvm/include/kvm/kvm-ipc.h
> > +++ b/tools/kvm/include/kvm/kvm-ipc.h
> > @@ -22,5 +22,6 @@ enum {
> > int kvm_ipc__register_handler(u32 type, void (*cb)(int fd, u32 type, u32 len, u8 *msg));
> > int kvm_ipc__handle(int fd, struct kvm_ipc_msg *msg);
> > int kvm_ipc__start(int sock);
> > +int kvm_ipc__stop(void);
> >
> > #endif
> > diff --git a/tools/kvm/kvm-ipc.c b/tools/kvm/kvm-ipc.c
> > index f05e926..65209e1 100644
> > --- a/tools/kvm/kvm-ipc.c
> > +++ b/tools/kvm/kvm-ipc.c
> > @@ -7,12 +7,14 @@
> > #include <sys/un.h>
> > #include <sys/types.h>
> > #include <sys/socket.h>
> > +#include <sys/eventfd.h>
> >
> > #define KVM_IPC_MAX_MSGS 16
> >
> > static void (*msgs[KVM_IPC_MAX_MSGS])(int fd, u32 type, u32 len, u8 *msg);
> > static DECLARE_RWSEM(msgs_rwlock);
> > -static int epoll_fd, server_fd;
> > +static int epoll_fd, server_fd, stop_fd;
> > +static pthread_t thread;
> >
> > int kvm_ipc__register_handler(u32 type, void (*cb)(int fd, u32 type, u32 len, u8 *msg))
> > {
> > @@ -109,8 +111,11 @@ static void *kvm_ipc__thread(void *param)
> > nfds = epoll_wait(epoll_fd, &event, 1, -1);
> > if (nfds > 0) {
> > int fd = event.data.fd;
> > -
> > - if (fd == server_fd) {
> > + printf("bleh\n");
> > + if (fd == stop_fd) {
> > + printf("Got stop signal\n");
> > + break;
>
> LOL. Can I have a version of the patch without those printf calls? :-)
Woopsie :)
--
Sasha.
next prev parent reply other threads:[~2011-10-25 11:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-25 10:40 [PATCH] kvm tools: Add method to stop ipc thread Sasha Levin
2011-10-25 10:42 ` Pekka Enberg
2011-10-25 11:27 ` Sasha Levin [this message]
2011-10-25 11:08 ` Osier Yang
2011-10-25 11:38 ` Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1319542039.3816.20.camel@lappy \
--to=levinsasha928@gmail.com \
--cc=asias.hejun@gmail.com \
--cc=gorcunov@gmail.com \
--cc=kvm@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=penberg@cs.helsinki.fi \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox