linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: Alan Stern <stern@rowland.harvard.edu>
Cc: "Luck, Tony" <tony.luck@intel.com>, Greg KH <gregkh@suse.de>,
	Ingo Molnar <mingo@elte.hu>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	"Rafael J. Wysocki" <rjw@sisk.pl>,
	"Srivatsa S. Bhat" <srivatsa.bhat@linux.vnet.ibm.com>,
	Sergei Trofimovich <slyich@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Linux PM mailing list <linux-pm@vger.kernel.org>,
	Borislav Petkov <bp@amd64.org>,
	"tglx@linutronix.de" <tglx@linutronix.de>,
	"prasad@linux.vnet.ibm.com" <prasad@linux.vnet.ibm.com>,
	Ming Lei <tom.leiming@gmail.com>,
	Djalal Harouni <tixxdz@opendz.org>,
	Borislav Petkov <borislav.petkov@amd.com>,
	Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>,
	Andi Kleen <ak@linux.intel.com>,
	"gouders@et.bocholt.fh-gelsenkirchen.de" 
	<gouders@et.bocholt.fh-gelsenkirchen.de>,
	Marcos Souza <marcos.mage@gmail.com>,
	"justinmattock@gmail.com" <justinmattock@gmail.com>,
	Jeff Chua <jeff.chua.linux@gmail.com>
Subject: Re: [PATCH] mce: fix warning messages about static struct mce_device
Date: Wed, 18 Jan 2012 19:50:20 +0100	[thread overview]
Message-ID: <CAPXgP10Du4nJ_hdfwqV0Fr6XEVkTMO6jZ_TS_T-J-grDG7nKJw@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.44L0.1201181257540.1343-100000@iolanthe.rowland.org>

On Wed, Jan 18, 2012 at 19:10, Alan Stern <stern@rowland.harvard.edu> wrote:

> There's nothing special about the driver model code in this respect.
> The same restriction applies wherever object lifetimes are controlled
> by reference counting.

Right. But it might not be obvious what 's the background here:

An allocated device object(memory) usually represents an actual
device(hardware). The object can have N users. Every of the users is
required to take a reference to the object, which pins the object's
memory as long as any of the N users might need to access it.

In a hotplug world, we deal with device-removal.  On disconnect, we
usually just orphan the object, we remove it from visibility,
disconnect the device <-> object relation.

All of the  N users with a reference can still access the memory, they
just do not talk to a real device anymore. The invalidated/orphaned
state is communicated otherwise by locks and flags in the device
object. Only after all of the N users left the object alone, the
memory of the orphan if free'd.

If in the time-window between disconnecting the object from the device
and freeing the orphaned object's memory, the same device comes back,
we allocate a new object which is associated with the device. It
usually has the same name and same properties as the original one.

This way, the new object is full functional, does not conflict with
the older one, and also all the users of the old memory are still fine
and can cleanup a lazy as they need without much synchronization.

Now, all that might not apply to machinecheck, and it might be that
machinecheck is fully able to handle all that just fine with the
statically allocated same memory -- allocating new device memory on
hotplug is still the model that should always be preferred over any
other, if possible.

It's usually the simplest safest and most flexible for anything that
can come and go at any time, and memory which might be in used by
other running code.

And hey, filesystems work successful with this model since ages.
Nobody invented anything new here. Device hotplug/unplug/cleanup is
not much different from create/unlink/release. Open/truncate is
usually much harder to manage in concurrency situations. :)

Kay

  reply	other threads:[~2012-01-18 18:50 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-16 22:40 [PATCH] mce: fix warning messages about static struct mce_device Greg KH
2012-01-17  0:14 ` Djalal Harouni
2012-01-17  0:15   ` Greg KH
2012-01-17  0:21     ` Linus Torvalds
2012-01-17  1:00       ` Greg KH
2012-01-17  8:38 ` Ingo Molnar
2012-01-17 15:51   ` Greg KH
2012-01-17 16:28     ` Greg KH
2012-01-18  9:31     ` Ingo Molnar
2012-01-18 14:42       ` Greg KH
2012-01-18 15:51         ` Alan Stern
2012-01-18 17:28           ` Luck, Tony
2012-01-18 17:54             ` Srivatsa S. Bhat
2012-01-18 18:10             ` Alan Stern
2012-01-18 18:50               ` Kay Sievers [this message]
2012-01-18 19:00                 ` Luck, Tony
2012-01-18 19:31                 ` Srivatsa S. Bhat
2012-01-19 12:32                 ` Ingo Molnar
2012-01-19 13:29                   ` Srivatsa S. Bhat
2012-01-19 15:13                     ` Alan Stern
2012-01-19 19:38                       ` Ingo Molnar
2012-01-19 20:52                         ` Alan Stern
2012-01-19 12:28         ` Ingo Molnar
2012-01-26 23:49           ` MCE: convert static array of pointers to per-cpu variables Greg KH
2012-01-27 13:14             ` Srivatsa S. Bhat
2012-01-17 12:36 ` [PATCH] mce: fix warning messages about static struct mce_device Srivatsa S. Bhat
2012-01-17 15:52   ` Greg KH

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=CAPXgP10Du4nJ_hdfwqV0Fr6XEVkTMO6jZ_TS_T-J-grDG7nKJw@mail.gmail.com \
    --to=kay.sievers@vrfy.org \
    --cc=ak@linux.intel.com \
    --cc=borislav.petkov@amd.com \
    --cc=bp@amd64.org \
    --cc=gouders@et.bocholt.fh-gelsenkirchen.de \
    --cc=gregkh@suse.de \
    --cc=jeff.chua.linux@gmail.com \
    --cc=justinmattock@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=marcos.mage@gmail.com \
    --cc=mingo@elte.hu \
    --cc=prasad@linux.vnet.ibm.com \
    --cc=rjw@sisk.pl \
    --cc=seto.hidetoshi@jp.fujitsu.com \
    --cc=slyich@gmail.com \
    --cc=srivatsa.bhat@linux.vnet.ibm.com \
    --cc=stern@rowland.harvard.edu \
    --cc=tglx@linutronix.de \
    --cc=tixxdz@opendz.org \
    --cc=tom.leiming@gmail.com \
    --cc=tony.luck@intel.com \
    --cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).