From: Greg KH <gregkh@linuxfoundation.org>
To: Alexander Graf <graf@amazon.com>
Cc: Adrian Catangiu <acatan@amazon.com>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
qemu-devel@nongnu.org, kvm@vger.kernel.org,
linux-s390@vger.kernel.org, rdunlap@infradead.org, arnd@arndb.de,
ebiederm@xmission.com, rppt@kernel.org, 0x7f454c46@gmail.com,
borntraeger@de.ibm.com, Jason@zx2c4.com, jannh@google.com,
w@1wt.eu, colmmacc@amazon.com, luto@kernel.org, tytso@mit.edu,
ebiggers@kernel.org, dwmw@amazon.co.uk, bonzini@gnu.org,
sblbir@amazon.com, raduweis@amazon.com, corbet@lwn.net,
mst@redhat.com, mhocko@kernel.org, rafael@kernel.org,
pavel@ucw.cz, mpe@ellerman.id.au, areber@redhat.com,
ovzxemul@gmail.com, avagin@gmail.com, ptikhomirov@virtuozzo.com,
gil@azul.com, asmehra@redhat.com, dgunigun@redhat.com,
vijaysun@ca.ibm.com, oridgar@gmail.com, ghammer@redhat.com
Subject: Re: [PATCH v8] drivers/misc: sysgenid: add system generation id driver
Date: Tue, 23 Mar 2021 13:56:05 +0100 [thread overview]
Message-ID: <YFnlZQZOasOwxUDn@kroah.com> (raw)
In-Reply-To: <a61c976f-b362-bb60-50a5-04073360e702@amazon.com>
On Mon, Mar 08, 2021 at 05:03:58PM +0100, Alexander Graf wrote:
>
>
> On 08.03.21 15:36, Greg KH wrote:
> >
> > On Mon, Mar 08, 2021 at 04:18:03PM +0200, Adrian Catangiu wrote:
> > > +static struct miscdevice sysgenid_misc = {
> > > + .minor = MISC_DYNAMIC_MINOR,
> > > + .name = "sysgenid",
> > > + .fops = &fops,
> > > +};
> >
> > Much cleaner, but:
> >
> > > +static int __init sysgenid_init(void)
> > > +{
> > > + int ret;
> > > +
> > > + sysgenid_data.map_buf = get_zeroed_page(GFP_KERNEL);
> > > + if (!sysgenid_data.map_buf)
> > > + return -ENOMEM;
> > > +
> > > + atomic_set(&sysgenid_data.generation_counter, 0);
> > > + atomic_set(&sysgenid_data.outdated_watchers, 0);
> > > + init_waitqueue_head(&sysgenid_data.read_waitq);
> > > + init_waitqueue_head(&sysgenid_data.outdated_waitq);
> > > + spin_lock_init(&sysgenid_data.lock);
> > > +
> > > + ret = misc_register(&sysgenid_misc);
> > > + if (ret < 0) {
> > > + pr_err("misc_register() failed for sysgenid\n");
> > > + goto err;
> > > + }
> > > +
> > > + return 0;
> > > +
> > > +err:
> > > + free_pages(sysgenid_data.map_buf, 0);
> > > + sysgenid_data.map_buf = 0;
> > > +
> > > + return ret;
> > > +}
> > > +
> > > +static void __exit sysgenid_exit(void)
> > > +{
> > > + misc_deregister(&sysgenid_misc);
> > > + free_pages(sysgenid_data.map_buf, 0);
> > > + sysgenid_data.map_buf = 0;
> > > +}
> > > +
> > > +module_init(sysgenid_init);
> > > +module_exit(sysgenid_exit);
> >
> > So you do this for any bit of hardware that happens to be out there?
> > Will that really work? You do not have any hwid to trigger off of to
> > know that this is a valid device you can handle?
>
> The interface is already useful in a pure container context where the
> generation change request is triggered by software.
>
> And yes, there are hardware triggers, but Michael was quite unhappy about
> potential races between VMGenID change and SysGenID change and thus wanted
> to ideally separate the interfaces. So we went ahead and isolated the
> SysGenID one, as it's already useful as is.
>
> Hardware drivers to inject change events into SysGenID can then follow
> later, for all different hardware platforms. But SysGenID as in this patch
> is a completely hardware agnostic concept.
Ok, this is going to play havoc with fuzzers and other "automated
testers", should be fun to watch! :)
Let's queue this up and see what happens...
thanks,
greg k-h
next prev parent reply other threads:[~2021-03-23 12:56 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-08 14:18 [PATCH v8] drivers/misc: sysgenid: add system generation id driver Adrian Catangiu
2021-03-08 14:36 ` Greg KH
2021-03-08 16:03 ` Alexander Graf
2021-03-08 17:24 ` Greg KH
2021-03-23 12:56 ` Greg KH [this message]
2021-03-23 16:10 ` Catangiu, Adrian Costin
2021-03-23 16:35 ` Greg KH
2021-03-24 16:38 ` Michael S. Tsirkin
2021-03-24 7:22 ` 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=YFnlZQZOasOwxUDn@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=0x7f454c46@gmail.com \
--cc=Jason@zx2c4.com \
--cc=acatan@amazon.com \
--cc=areber@redhat.com \
--cc=arnd@arndb.de \
--cc=asmehra@redhat.com \
--cc=avagin@gmail.com \
--cc=bonzini@gnu.org \
--cc=borntraeger@de.ibm.com \
--cc=colmmacc@amazon.com \
--cc=corbet@lwn.net \
--cc=dgunigun@redhat.com \
--cc=dwmw@amazon.co.uk \
--cc=ebiederm@xmission.com \
--cc=ebiggers@kernel.org \
--cc=ghammer@redhat.com \
--cc=gil@azul.com \
--cc=graf@amazon.com \
--cc=jannh@google.com \
--cc=kvm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mhocko@kernel.org \
--cc=mpe@ellerman.id.au \
--cc=mst@redhat.com \
--cc=oridgar@gmail.com \
--cc=ovzxemul@gmail.com \
--cc=pavel@ucw.cz \
--cc=ptikhomirov@virtuozzo.com \
--cc=qemu-devel@nongnu.org \
--cc=raduweis@amazon.com \
--cc=rafael@kernel.org \
--cc=rdunlap@infradead.org \
--cc=rppt@kernel.org \
--cc=sblbir@amazon.com \
--cc=tytso@mit.edu \
--cc=vijaysun@ca.ibm.com \
--cc=w@1wt.eu \
/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