Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp653749pxb; Tue, 2 Feb 2021 14:28:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJyM9CkvKhrGDekw0dboU1NwTGjwwZ5v9yxGBMJUEIdqudpWeAqCLiX9WcDjuaWqz/yANozh X-Received: by 2002:a17:906:509:: with SMTP id j9mr167892eja.89.1612304928814; Tue, 02 Feb 2021 14:28:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612304928; cv=none; d=google.com; s=arc-20160816; b=mdxx531Vd4FwC/J+9pbxdlDmqxYBN4W7TH+K6ysNI7zENewYlrWLR5sYfuEbyWO+Q6 pXQgXAmtX+xO1OwvVrwFVlPUJ8mmJfQIQOkHKhVNGZ7IGyLF1pN54dNi7ZhFWOhl93th jqpuhzQSO9QhryeKUbcvsMkez5IZz5RyZOAb6fy5R1kKzGrBDOljQaYwdjdvK+Ices03 ayd60Cq5l17lXXNpCi5LmozJWs1kCvTQPqGAa8iSoLMex62y83zfTwgNlmjr4+6eh9nR NF7Kohd1NZm0SoOwdKmoQeuqW/oqCzEFfEax2b5yXMkShKbu1786DQ9J3ziw0DiR/y+Z hc+w== 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=pWynqGmsBPMo2csT8/XD1/efepqrc/Xop2AsNdNMfV8=; b=RPi5b3rXFrcDxfKsHtp5Mrb7LIJFfkNP5CzUGJFu91WnE4L1JqVGZPsCANS3sanKF+ fz3w2HnVfkKM0gqNNx8fnUbiRlRjiieMDuHn99in0YUwFIjBSWGYMnLwNx7XZZ9kKpLX QiVMwaRzHKKpGNi3IyroI3NlwkOs1VnvB3dE4RgIw99KY+zT7RSlBWTgQSwF/t9kFwX8 6T4nAaRs0BofTbDvjQZw/Q4gLAPMd1vO3RpRPE5Ni95I5g/QSubwciaNdOkVWeSSKkwc v4XebT6aWHUy/2nXwOofH0yXG7Lpezd3B6+UWrHKytkKvr2XNkcI05sbmwEkVkIQFefH FX5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Fem1xK+5; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v26si52856edt.332.2021.02.02.14.28.23; Tue, 02 Feb 2021 14:28:48 -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=@redhat.com header.s=mimecast20190719 header.b=Fem1xK+5; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234659AbhBBOsG (ORCPT + 99 others); Tue, 2 Feb 2021 09:48:06 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:25139 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234611AbhBBOfi (ORCPT ); Tue, 2 Feb 2021 09:35:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612276451; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=pWynqGmsBPMo2csT8/XD1/efepqrc/Xop2AsNdNMfV8=; b=Fem1xK+5Q/CP+MVOoifpu/8tzY9RQYf9CqMHZZrJSpPIw8dy/ojetmcdGsAHjJgV1cLL42 0ZEAPwBaRRmDZ6GRFXy3Gt5mAPJhLMXbYe4GW8H/0oVo6bvmytV3+dLGLr7LiF2NcUVmQ1 MxGQKJ79Rpn0OiZtLkIfuZyYHb2+nEM= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-513-yHYrkFApNEa15hHGBwMEtQ-1; Tue, 02 Feb 2021 09:34:09 -0500 X-MC-Unique: yHYrkFApNEa15hHGBwMEtQ-1 Received: by mail-wr1-f69.google.com with SMTP id c1so12673142wrx.2 for ; Tue, 02 Feb 2021 06:34:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=pWynqGmsBPMo2csT8/XD1/efepqrc/Xop2AsNdNMfV8=; b=JIj7QSH8/ndW8dzdp4yTAwXFAjct1zdlTHSCAaRnvvesRWaIDL2+Y1y4m9ck9El8zD GTHlPOSvHj0RdK5UleURVSk7r2+V2giC9CctAGpUwYduiLK7Yn/+W2Z1GQKB+p9uJ8Gq +bF0iFENHhjEg6qvmkLkxJ6gg9g8MZ8w+ocO577TNxTQHTC3RXcSmCim3Q6wvVKLShwS m67Ad0ZFqXMjSll9YymVlZjBacBe4f7bTZNomZky7o0lZNWhQeX4zPkQszhA5CiqE4Gt YblhBgFtQGMlgVApya+uj5vFFtvUxsWwcYZAKrsQFvu8GMaHkoSaXebuyRxx9M4f5wAh aojw== X-Gm-Message-State: AOAM533XR2j+mi9TBRN8V165QwReCTO3aPn3Jv7PPOadDyhvQU/1GfIG w7OKvPTvCYj0Ro/2ZEBW+Zi7y3JiMheL8qpvPV4nqy4cGan4kWimqWesGKSNEE00E0VnXXC6f0u j5YLQ9sVc8qqetCU0HpICJ8Hy X-Received: by 2002:a5d:4806:: with SMTP id l6mr24622879wrq.389.1612276448267; Tue, 02 Feb 2021 06:34:08 -0800 (PST) X-Received: by 2002:a5d:4806:: with SMTP id l6mr24622831wrq.389.1612276448024; Tue, 02 Feb 2021 06:34:08 -0800 (PST) Received: from redhat.com (bzq-79-177-39-148.red.bezeqint.net. [79.177.39.148]) by smtp.gmail.com with ESMTPSA id q9sm3873912wme.18.2021.02.02.06.34.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Feb 2021 06:34:05 -0800 (PST) Date: Tue, 2 Feb 2021 09:34:00 -0500 From: "Michael S. Tsirkin" To: Alexander Graf Cc: "Catangiu, Adrian Costin" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "qemu-devel@nongnu.org" , "kvm@vger.kernel.org" , "linux-s390@vger.kernel.org" , "gregkh@linuxfoundation.org" , "arnd@arndb.de" , "ebiederm@xmission.com" , "rppt@kernel.org" , "0x7f454c46@gmail.com" <0x7f454c46@gmail.com>, "borntraeger@de.ibm.com" , "Jason@zx2c4.com" , "jannh@google.com" , "w@1wt.eu" , "MacCarthaigh, Colm" , "luto@kernel.org" , "tytso@mit.edu" , "ebiggers@kernel.org" , "Woodhouse, David" , "bonzini@gnu.org" , "Singh, Balbir" , "Weiss, Radu" , "corbet@lwn.net" , "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 v4 0/2] System Generation ID driver and VMGENID backend Message-ID: <20210202093337-mutt-send-email-mst@kernel.org> References: <1610453760-13812-1-git-send-email-acatan@amazon.com> <20210112074658-mutt-send-email-mst@kernel.org> <9952EF0C-CD1D-4EDB-BAB8-21F72C0BF90D@amazon.com> <20210127074549-mutt-send-email-mst@kernel.org> <7bcd1cf3-d055-db46-95ea-5c023df2f184@amazon.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7bcd1cf3-d055-db46-95ea-5c023df2f184@amazon.de> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 28, 2021 at 01:58:12PM +0100, Alexander Graf wrote: > Hey Michael! > > On 27.01.21 13:47, Michael S. Tsirkin wrote: > > > > On Thu, Jan 21, 2021 at 10:28:16AM +0000, Catangiu, Adrian Costin wrote: > > > On 12/01/2021, 14:49, "Michael S. Tsirkin" wrote: > > > > > > On Tue, Jan 12, 2021 at 02:15:58PM +0200, Adrian Catangiu wrote: > > > > The first patch in the set implements a device driver which exposes a > > > > read-only device /dev/sysgenid to userspace, which contains a > > > > monotonically increasing u32 generation counter. Libraries and > > > > applications are expected to open() the device, and then call read() > > > > which blocks until the SysGenId changes. Following an update, read() > > > > calls no longer block until the application acknowledges the new > > > > SysGenId by write()ing it back to the device. Non-blocking read() calls > > > > return EAGAIN when there is no new SysGenId available. Alternatively, > > > > libraries can mmap() the device to get a single shared page which > > > > contains the latest SysGenId at offset 0. > > > > > > Looking at some specifications, the gen ID might actually be located > > > at an arbitrary address. How about instead of hard-coding the offset, > > > we expose it e.g. in sysfs? > > > > > > The functionality is split between SysGenID which exposes an internal u32 > > > counter to userspace, and an (optional) VmGenID backend which drives > > > SysGenID generation changes based on hw vmgenid updates. > > > > > > The hw UUID you're referring to (vmgenid) is not mmap-ed to userspace or > > > otherwise exposed to userspace. It is only used internally by the vmgenid > > > driver to find out about VM generation changes and drive the more generic > > > SysGenID. > > > > > > The SysGenID u32 monotonic increasing counter is the one that is mmaped to > > > userspace, but it is a software counter. I don't see any value in using a dynamic > > > offset in the mmaped page. Offset 0 is fast and easy and most importantly it is > > > static so no need to dynamically calculate or find it at runtime. > > > > Well you are burning a whole page on it, using an offset the page > > can be shared with other functionality. > > Currently, the SysGenID lives is one page owned by Linux that we share out > to multiple user space clients. So yes, we burn a single page of the system > here. > > If we put more data in that same page, what data would you put there? Random > other bits from other subsystems? At that point, we'd be reinventing vdso > all over again, no? Probably with the same problems. > > Which gets me to the second alternative: Reuse VDSO. The problem there is > that the VDSO is an extremely architecture specific mechanism. Any new > architecture we'd want to support would need multiple layers of changes in > multiple layers of both kernel and libc. I'd like to avoid that if we can > :). > > So that leaves us with either wasting a page per system or not having an > mmap() interface in the first place. > > The reason we have the mmap() interface is that it's be easier to consume > for libraries, that are not hooked into the main event loop. > > So, uh, what are you suggesting? :) I'd drop mmap at this point. I haven't seen a way to use it that isn't racy. > > Alex > > > > Amazon Development Center Germany GmbH > Krausenstr. 38 > 10117 Berlin > Geschaeftsfuehrung: Christian Schlaeger, Jonathan Weiss > Eingetragen am Amtsgericht Charlottenburg unter HRB 149173 B > Sitz: Berlin > Ust-ID: DE 289 237 879 > >