From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A2A2C433E6 for ; Thu, 28 Jan 2021 12:59:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 114D564DD8 for ; Thu, 28 Jan 2021 12:59:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231989AbhA1M7o (ORCPT ); Thu, 28 Jan 2021 07:59:44 -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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.1 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63A48C433E0 for ; Thu, 28 Jan 2021 12:59:45 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A41DB64DD8 for ; Thu, 28 Jan 2021 12:59:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A41DB64DD8 Authentication-Results: mail.kernel.org; dmarc=pass (p=none dis=none) header.from=nongnu.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:51686 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l56tj-0006pK-Bp for qemu-devel@archiver.kernel.org; Thu, 28 Jan 2021 07:59:43 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:47080) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l56si-0006L0-RB for qemu-devel@nongnu.org; Thu, 28 Jan 2021 07:58:40 -0500 Received: from smtp-fw-6001.amazon.com ([52.95.48.154]:62217) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l56sf-0005wg-TM for qemu-devel@nongnu.org; Thu, 28 Jan 2021 07:58:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1611838718; x=1643374718; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=B56E1Awf7VEQPdUFQmhu23n9pP7LJrGNglTlfuHed+U=; b=TOCQtySzNvOPnLiOyEDSeRvahRcUH5EAHaFvdwWVRZQ9leUbjhUQQIBT xW9yOxwtFclPG/6SfBT/3Kx7jZ41IWW35jFlFuCHLRlmblwlQyB3TA1SQ uxY4Rh4yt9O2KQ1BbHTOdNVNGjo3Z+Sj/b2V6Q5nNpuNEjoqzq8vDgeNf Q=; 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" 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> 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) Precedence: Bulk Content-Type: text/plain; charset="windows-1252"; format="flowed" Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=52.95.48.154; envelope-from=prvs=655880f0b=graf@amazon.de; helo=smtp-fw-6001.amazon.com X-Spam_score_int: -46 X-Spam_score: -4.7 X-Spam_bar: ---- X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.252, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-0.001, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Jason@zx2c4.com" , "dgunigun@redhat.com" , "kvm@vger.kernel.org" , "linux-doc@vger.kernel.org" , "ghammer@redhat.com" , "vijaysun@ca.ibm.com" , "0x7f454c46@gmail.com" <0x7f454c46@gmail.com>, "qemu-devel@nongnu.org" , "mhocko@kernel.org" , "oridgar@gmail.com" , "avagin@gmail.com" , "pavel@ucw.cz" , "ptikhomirov@virtuozzo.com" , "linux-s390@vger.kernel.org" , "corbet@lwn.net" , "mpe@ellerman.id.au" , "rafael@kernel.org" , "ebiggers@kernel.org" , "borntraeger@de.ibm.com" , "Singh, Balbir" , "bonzini@gnu.org" , "arnd@arndb.de" , "jannh@google.com" , "Weiss, Radu" , "asmehra@redhat.com" , "rppt@kernel.org" , "luto@kernel.org" , "gil@azul.com" , "MacCarthaigh, Colm" , "tytso@mit.edu" , "gregkh@linuxfoundation.org" , "areber@redhat.com" , "linux-kernel@vger.kernel.org" , "ebiederm@xmission.com" , "ovzxemul@gmail.com" , "w@1wt.eu" , "Woodhouse, David" Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Reply-to: Alexander Graf From: graf--- via 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