Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp965359pxb; Thu, 28 Jan 2021 05:04:24 -0800 (PST) X-Google-Smtp-Source: ABdhPJwIvsQ+OyFHTtxBsiqk2lrXLMlozQavFXCa61sJxrfNOk/WOk0x6GweIISMvkVRioVvTEpe X-Received: by 2002:a17:906:4451:: with SMTP id i17mr9022383ejp.436.1611839064497; Thu, 28 Jan 2021 05:04:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611839064; cv=none; d=google.com; s=arc-20160816; b=XefLocIB1oxHQJHqt4+uMN3GkVNvfkT4qaTYuBFyBhrXbd4k0uWxcKJ7qJyAVcE3b1 1m/ps0HKtpg75sBKtgg/HVpJn9zinfz4lcN12L6Uca+hEZ6tx55/rg9NEuNI+HtfGqvz Azre/Xgl2lmjIKYfh4CMD/mzVN3ItfWW5ToVjkgcy7kFpeX92+MhQuq6w7JLdy4czwAU BNPDFEAqNbdALchmBRcjiA3BIv8drHfT6CKrfiuQBEmwjAMCU9Dba80FoB7/So2t+yGH Ovnbk3x+jnkcPUn5qT4TAceAeXhYDEKUm8KTyrd0BAEh/s2DQoHuR2xG8aW0BAkYpYPz uZxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=B56E1Awf7VEQPdUFQmhu23n9pP7LJrGNglTlfuHed+U=; b=WJT4qN0r06LDkq8nJwqEYldFnTM6as1XENFpYl4reILyllUExkACX5haSAnBwPB7rP u6mYHE7xw1WFodiv3DmeriTdBbtwfSapH7lT5E4pEPEwy3ETRJMna6S7jOHtSpRq2SCW EoyAoZ/vHc3532yfMW3eLTXqezHEzSA+WoDen+vwAP1Vu/skFvCbVGDXeiMyCZtYLSPG 1w3tjlI4HyfMXmtMaHz2fL4Ywy7hcCuV7mJyXomKIIuGZxADENZd9BEUioyIbAb11MMX 4XsxR2hQuU4JBXnpW2fW46NBrqzO4FbcHk9Bdu6lGY47ZDwdtXPNO3aJ404bLdx/F8xn ffvA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=ERdJQ3q0; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q18si2429389ejt.469.2021.01.28.05.03.57; Thu, 28 Jan 2021 05:04:24 -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=@amazon.de header.s=amazon201209 header.b=ERdJQ3q0; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231967AbhA1M7l (ORCPT + 99 others); Thu, 28 Jan 2021 07:59:41 -0500 Received: from smtp-fw-6001.amazon.com ([52.95.48.154]:62208 "EHLO smtp-fw-6001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231932AbhA1M7R (ORCPT ); Thu, 28 Jan 2021 07:59:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1611838756; x=1643374756; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=B56E1Awf7VEQPdUFQmhu23n9pP7LJrGNglTlfuHed+U=; b=ERdJQ3q0L8dvF3APuLnziiKfn9NEKDpQpubh+o8HN7qA+Y+m5tQ3eLN1 3nfh847FpF1czOV4xRQu6/YTw8MIGNz+qhdLFcOtzXhlf95sZmPujaqcc w7HXqVpJNWioN8ECo+IFIdgdl9Nk45NFKEyQx8R5rJm5GdFG4Mc+e3nAc 4=; X-IronPort-AV: E=Sophos;i="5.79,382,1602547200"; d="scan'208";a="82178107" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-2b-a7fdc47a.us-west-2.amazon.com) ([10.43.8.2]) by smtp-border-fw-out-6001.iad6.amazon.com with ESMTP; 28 Jan 2021 12:58:25 +0000 Received: from EX13MTAUWC002.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-2b-a7fdc47a.us-west-2.amazon.com (Postfix) with ESMTPS id 6DE2AC0600; Thu, 28 Jan 2021 12:58:22 +0000 (UTC) Received: from EX13D20UWC001.ant.amazon.com (10.43.162.244) by EX13MTAUWC002.ant.amazon.com (10.43.162.240) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 28 Jan 2021 12:58:21 +0000 Received: from Alexanders-MacBook-Air.local (10.43.162.125) by EX13D20UWC001.ant.amazon.com (10.43.162.244) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 28 Jan 2021 12:58:14 +0000 Subject: Re: [PATCH v4 0/2] System Generation ID driver and VMGENID backend To: "Michael S. Tsirkin" , "Catangiu, Adrian Costin" CC: "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" 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> From: Alexander Graf Message-ID: <7bcd1cf3-d055-db46-95ea-5c023df2f184@amazon.de> Date: Thu, 28 Jan 2021 13:58:12 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.16; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <20210127074549-mutt-send-email-mst@kernel.org> Content-Language: en-US X-Originating-IP: [10.43.162.125] X-ClientProxiedBy: EX13D02UWC002.ant.amazon.com (10.43.162.6) To EX13D20UWC001.ant.amazon.com (10.43.162.244) Content-Type: text/plain; charset="windows-1252"; format="flowed" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 expos= es 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 rea= d() >> > which blocks until the SysGenId changes. Following an update, rea= d() >> > 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. Alternativ= ely, >> > 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 offse= t, >> 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 importantl= y 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? :) 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