kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: "Pandarathil, Vijaymohan R" <vijaymohan.pandarathil@hp.com>
Cc: "kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: Recommended way access KVM data structures from other kernel subsystems ?
Date: Mon, 03 Sep 2012 12:26:07 +0300	[thread overview]
Message-ID: <504477AF.1070900@redhat.com> (raw)
In-Reply-To: <F9E001219150CB45BEDC82A650F360C9A9651A@G4W3300.americas.hpqcorp.net>

On 08/23/2012 10:49 AM, Pandarathil, Vijaymohan R wrote:
> Hi,
> 
> I am looking for the recommended approach for accessing KVM driver data from other kernel components. In my case, I need to set some global variable/state in KVM driver from one of the NMI handlers.  I see that using kvm_x86_ops is one option. I can define a new function as part of kvm_x86_ops and invoke that function from the NMI handler as below.
> 
> nmi_handler() {
> 
> ...
>        If (kvm_x86_ops) {
> 		kvm_x86_ops->new_fn();
> 
> }
> 
> after adding new_func() to struct kvm_x86_ops.
> 
> Is this the right approach ? 

No, kvm_x86_ops is not available to the core kernel code.

> Or is there some other existing mechanism ? Is KVM driver always loaded ?

No.

> I am fairly new to KVM and so any guidance is very much appreciated.

Do something like

  void nmi_xyz_register(struct nmi_xyz *x);
  void nmi_xyz_unregister(struct nmi_xyz *x);

  struct nmi_xyz {
      void (*nmi)(void);
  };

then add code to kvm to use nmi_xyz (whatever that is).

-- 
error compiling committee.c: too many arguments to function

      reply	other threads:[~2012-09-03  9:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-23  7:49 Recommended way access KVM data structures from other kernel subsystems ? Pandarathil, Vijaymohan R
2012-09-03  9:26 ` Avi Kivity [this message]

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=504477AF.1070900@redhat.com \
    --to=avi@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=vijaymohan.pandarathil@hp.com \
    /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;
as well as URLs for NNTP newsgroup(s).