public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joerg Roedel <joro@8bytes.org>
To: Greg KH <greg@kroah.com>
Cc: Joerg Roedel <joerg.roedel@amd.com>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: pci_get_dev_by_id() from interrupt handlers
Date: Tue, 20 Apr 2010 19:35:59 +0200	[thread overview]
Message-ID: <20100420173552.GA15669@8bytes.org> (raw)
In-Reply-To: <20100420163215.GB3270@kroah.com>

On Tue, Apr 20, 2010 at 09:32:15AM -0700, Greg KH wrote:
> On Tue, Apr 20, 2010 at 06:04:24PM +0200, Joerg Roedel wrote:
> > Hi Jesse,
> > 
> > I have a question regarding the warning in the pci_get_dev_by_id()
> > [search.c] function which triggers when called from interrupt context.
> > As far as I have seen this function should be save to be called in
> > atomic mode.
> 
> Are you sure?

Not anymore. You proved me wrong ;-)

> > Is there any other reason it should not be called in interrupt
> > handlers?
> 
> klist traversal is not safe to be done in interrupt context as the
> spinlock is not told to be interrupt safe.  Now you could go and change
> the klist core to be interrupt safe, but you should probably rethink
> your need here first.

The idea was to capture IO page faults in the IOMMU and propagate them
to KVM instead of just printk into dmesg. KVM could do something better
then like killing the guest. Currently a malicious guest could flood
host dmesg by causing IO page faults.
For the AMD IOMMU the page faults are reported in an event log and the
cpu is informed by an interrupt about it. The event log entry contains
the bus/dev/function of the device. To get the necessary information to
propagate this to KVM I need to get the 'struct device' for it.
I could certainly do this in a tasklet instead but doing that only for
the task of converting bus/device/function into 'struct device' sounds
a bit complicated to me.

Regards,

	Joerg


  reply	other threads:[~2010-04-20 17:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-20 16:04 pci_get_dev_by_id() from interrupt handlers Joerg Roedel
2010-04-20 16:32 ` Greg KH
2010-04-20 17:35   ` Joerg Roedel [this message]
2010-04-20 17:52     ` Greg KH
2010-04-21 10:05       ` Joerg Roedel
2010-04-21 10:21         ` Peter Zijlstra
2010-04-21 10:41           ` Joerg Roedel
2010-04-21 10:46             ` Peter Zijlstra
2010-04-21 10:55               ` Joerg Roedel

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=20100420173552.GA15669@8bytes.org \
    --to=joro@8bytes.org \
    --cc=greg@kroah.com \
    --cc=jbarnes@virtuousgeek.org \
    --cc=joerg.roedel@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    /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