public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Dave Airlie <airlied@gmail.com>,
	Tiago Vignatti <tiago.vignatti@nokia.com>,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	Dave Airlie <airlied@redhat.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] vga: implements VGA arbitration on Linux
Date: Fri, 17 Jul 2009 10:20:10 +1000	[thread overview]
Message-ID: <1247790010.27937.71.camel@pasglop> (raw)
In-Reply-To: <20090716094855.455c3f77@lxorguk.ukuu.org.uk>

On Thu, 2009-07-16 at 09:48 +0100, Alan Cox wrote:
> 
> > >> +             pdev = vga_default_device();
> > >
> > > What if the BIOS provided device was hot unplugged ?
> > 
> > we just use the pdev as a cookie, if it was hot unplugged we'll
> > have gotten a callback to remove it from the VGA device list
> > and the lookup which happens 5 lines later inside the spinlock
> > will fail.
> 
> What if I inserted a new device - the allocator might give me a new
> device with the same pointer if its reusing the same slab entry for
> that
> size. Unlikely but given a zillion boxes this starts to occur 8(

The original proof-of concept draft code I wrote (and this is -very-
close to it :-) didn't quite handle hotplug of the default device. That
does need to be sorted.

But then, I have a hard time finding any useful locking to use vs. PCI
hotplug, so it's a non trivial matter.

> Not commented on - but a serious question would be "do we actually
> care enough or are there really devices with just I/O and just vga
> memory access used ?"

I honestly cannot remember why I split the 4 resource types that way
back then. I have the nagging feeling that I had a good reason to do so
but it totally eludes me today :-)

The one main thing I wanted was to keep legacy vs. standard resources so
that the all the portions of a driver (DDX, DRM, etc...) that use
standard resources can continue to lock/unlock just these, without
having to know whether one of the elements disable legacy decoding (or
is trying to request it again).

But maybe somebody with a fresh new look on all this will rightfully say
"fuck it, that's too complicated" and turn the whole thing into a single
token to pass around.

> Your cookie validity is suspect I fear. 

Yes, it is sadly.

> Also holding the device reference means you stop that exact set of
> resources being reissued too early and
> you (or clients) scribbling on them through unfortunate timing. So I
> think you actually do need to grab references properly, Doesn't make
> the
> code much more complex that I can see.
> 
Well, we are in the device addition/removal path, so the list of vga
devices doesn't need to hold a reference here. However, we probably need
to make sure we take one when we peek something from that list.

Cheers,
Ben.


  parent reply	other threads:[~2009-07-17  0:20 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-14 12:57 [PATCH 0/2] VGA arbiter implementation Tiago Vignatti
2009-07-14 12:57 ` [PATCH 1/2] vga: implements VGA arbitration on Linux Tiago Vignatti
2009-07-14 12:57   ` [PATCH 2/2] vga: drops a documentation regarding the VGA arbiter Tiago Vignatti
2009-07-18 11:48     ` Pavel Machek
2009-07-19 18:50       ` Vignatti Tiago (Nokia-D/Helsinki)
2009-07-14 14:35   ` [PATCH 1/2] vga: implements VGA arbitration on Linux Alan Cox
2009-07-15  4:43     ` Dave Airlie
2009-07-16  4:25     ` Dave Airlie
2009-07-16  8:48       ` Alan Cox
2009-07-16 10:38         ` Dave Airlie
2009-07-16 16:25           ` Jesse Barnes
2009-07-17  0:22           ` Benjamin Herrenschmidt
2009-07-17  0:20         ` Benjamin Herrenschmidt [this message]
2009-07-17  5:00     ` Dave Airlie
2009-07-17  5:12       ` Benjamin Herrenschmidt
2009-07-14 16:15   ` Greg KH
2009-07-16  3:54     ` Dave Airlie
2009-07-16  4:02       ` Greg KH
2009-07-16  4:06         ` Dave Airlie
2009-07-16  8:41       ` Alan Cox
2009-07-17  0:24         ` Benjamin Herrenschmidt
2009-07-17  0:23       ` Benjamin Herrenschmidt
2009-07-18 11:47   ` Pavel Machek

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=1247790010.27937.71.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=airlied@gmail.com \
    --cc=airlied@redhat.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=tiago.vignatti@nokia.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