Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1921484pxb; Mon, 8 Mar 2021 09:26:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJxisXsQdJ/7ot0SEimBtWdV6RyCXDkAijgl7E6h7J1GG5AEEr/9cL2GC8cZsVnuG2jvM4iV X-Received: by 2002:a50:bb47:: with SMTP id y65mr23809508ede.305.1615224401014; Mon, 08 Mar 2021 09:26:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615224401; cv=none; d=google.com; s=arc-20160816; b=yaJrM/M6U07YVlKs7kCD0A1ReFSztcKGjbd0BNEq/NUL608yDQVUGiK4GQvESDhiUk G0XKftiyhOC5UrL9oe2m9YMrFzFcZ256ynmD0mvbzPQ52Mq8w7nfegvqnOKr5Lvw3ZXI U7RNQBhSbZVf2uxftAY8ohmlDO+JbDZd5eevLJ4wRri0+EhNKnOwZdFjtRfdd6zdV1jh wx27bB32ynRPKdRaaRBdzbtSAUupD/4fVsZsvjVzwHxPY5iqJoqrd92O9y/W6VUuLWrg mnBgwOlIkl7Eso6lXt4BKr20oCg5j4RrT3A8FWdzpB7xroMiaujHYOs24ugG7bW4f+hL zTBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Fq7OICNy80Azz/rfjIBShuA+Jm99TwWYoM0jcswt2jk=; b=jY+/ORQEzwodKeNks2wqnd0bD0hBHTePgaf3T07knG9S5OzCaosq+OnBtN7pzzVupv d4dvxNUDTuLVQIxALpu6XssxXQGayPcKLmBFzcceFXStXYVoFwJ/sVha4iuHN4D++r6D M/Jg4j2jG0kGpYB1oZmgjqy8l9XxpR502sHOJdbjywCvBuSpW9LnvpUP6HhDax1Rv/ji RtYLDTUxfg1peYjxQU/8LhV/FBPr0y7Svd6hOW2MOeVust5WN3sBU0v9T9uMajmqAhYc JaSjVvleEIwrVpHlKyGn5KRrw9kNGlimy7Hn1SUVJ/8mZo2n3zyTPJWzJbrDrfY5UXJP O43A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ox8FtV0m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b11si8589974edn.206.2021.03.08.09.26.10; Mon, 08 Mar 2021 09:26:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ox8FtV0m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231215AbhCHRZB (ORCPT + 99 others); Mon, 8 Mar 2021 12:25:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:35710 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231208AbhCHRYr (ORCPT ); Mon, 8 Mar 2021 12:24:47 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A52356520F; Mon, 8 Mar 2021 17:24:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615224287; bh=mM7ct2vgRlQeJ6mmmYx4ShAL1KKFFLg9U+ZCmnf0rDA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ox8FtV0m2DJVYbt3iY5k+JsCuBCZYeAax/5KG5HDdHKEeeI8sCl3nSGWG3yxIemTQ zo57Q6vcHbPtuQ3m++iZxB3o17ukYqBu+NyjDs2esBwc2yzujLL0srdvXbrkEFBJBk TuOz/byGz6rgCi4wOlsohTDSEYC+AgfW5dtmIhnk= Date: Mon, 8 Mar 2021 18:24:44 +0100 From: Greg KH To: Alexander Graf Cc: Adrian Catangiu , 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 Message-ID: References: <1615213083-29869-1-git-send-email-acatan@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, so what is going to cause this driver to be automatically loaded? How will userspace "know" they want this and know to load it? This really is just a shared memory "driver", it's gotten so small now, so why can't this just be a userspace program/server now? :) thanks, greg k-h