Received: by 10.213.65.68 with SMTP id h4csp1649492imn; Thu, 15 Mar 2018 05:57:41 -0700 (PDT) X-Google-Smtp-Source: AG47ELt9yo/WxECkFHnf1ZoZ7tI9DGXCt5c5mxXcO3oYDwzw5VeIXu0Qb9P0GE6W3dxePUu+CY/A X-Received: by 10.98.189.24 with SMTP id a24mr7697067pff.125.1521118661278; Thu, 15 Mar 2018 05:57:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521118661; cv=none; d=google.com; s=arc-20160816; b=P48i3fw76Ua26VQsV2hjPVB+9ZbLy5icDboRIaXIlU+oxziQ9ETW5nVzcEyED7Vj2n b/89BHwTtMRG80SInK9wFnsdAj2fiA8d4GghUJZgZZ3TIVqIHM11G2sw+SSmes8PSMx+ eZl79ZW58Tj22ZEcbT6Da5heehxoFWoClAkqSVvU73ysNgVMby4kZu2/cfO0kdK1EHPh hAOMftXH96PmhI5yGoiwKEOIPL6D3NYGPhCh9hEj3RwB6PiSZAxlxAOCI2U9reyx/znv vS8o7zZGaxyHX1QSSLzRWexUgbU0GemNh5GaXZY8joDBZIcOLap31hQ3Hf+Iv7ZmzpQl cWdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :arc-authentication-results; bh=MGF9sAMB2F2PGK8httUFAdokn759ItZZg8SxEDhrODg=; b=QpXPufo4Jx0VWeALHYdk3srcEC+lMVO46D3qBzGAHqKE2BEPWw67HPlkK6WCTQXoqR yho+nLZXqBY1UL2hag7xt/1TG3t+or/EeiihEqKXu0K0mQVjWRpSy+w8vQgcAxNAMBeH ciY4hYJj07jbwCeWvzJHGCwwqRnsIRNj2Bx2xZ4ensCCorrRN6VmJgBa/YDIjdy+x4W8 D45Ze9KqxkOiOiLoqguVQ0Dt2RX7CgTKGJUfh5CG8h8kLGee0w6PIA0Z47LvpKCVwga4 m0c0RFO8Bt7Wob9jGqAWDDMfQUCm1WZWogSQGuXXo/mki/Z0qyTrrVuqksJBqNqFjNpa M3ZQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z9-v6si3942506plo.2.2018.03.15.05.57.26; Thu, 15 Mar 2018 05:57:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752463AbeCOMzH (ORCPT + 99 others); Thu, 15 Mar 2018 08:55:07 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:45844 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752450AbeCOMzF (ORCPT ); Thu, 15 Mar 2018 08:55:05 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EF81B40201A3; Thu, 15 Mar 2018 12:55:04 +0000 (UTC) Received: from redhat.com (ovpn-123-150.rdu2.redhat.com [10.10.123.150]) by smtp.corp.redhat.com (Postfix) with SMTP id 9743E2026980; Thu, 15 Mar 2018 12:55:02 +0000 (UTC) Date: Thu, 15 Mar 2018 14:55:02 +0200 From: "Michael S. Tsirkin" To: Gal Hammer Cc: Greg KH , Or Idgar , linux-kernel@vger.kernel.org, Arnd Bergmann , Or Idgar , Or Idgar Subject: Re: [PATCH v5] drivers/misc: vm_gen_counter: initial driver implementation Message-ID: <20180315145338-mutt-send-email-mst@kernel.org> References: <20180301142215.11812-1-idgar@virtualoco.com> <20180313190617-mutt-send-email-mst@kernel.org> <20180314182536.GA14504@kroah.com> <20180314211704-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 15 Mar 2018 12:55:05 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Thu, 15 Mar 2018 12:55:05 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'mst@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Mar 15, 2018 at 08:57:05AM +0200, Gal Hammer wrote: > On Wed, Mar 14, 2018 at 9:25 PM, Michael S. Tsirkin wrote: > > On Wed, Mar 14, 2018 at 07:25:36PM +0100, Greg KH wrote: > >> On Tue, Mar 13, 2018 at 07:40:51PM +0200, Michael S. Tsirkin wrote: > >> > I think it's a good idea to use sysfs for this. However, > >> > there are a couple of missing interfaces here: > >> > > >> > 1. Userspace needs a way to know when this value changes. > >> > I see no change notifications here and that does not seem right. > >> > >> How can these change? > > > > It's a hardware register. It changes when hardware feels like it :) > > In particular, it changes whenever VM is migrated or snapshotted. > > This value doesn't change when a VM is migrated. It is unlikely that > this value will be changed so frequently that a direct access to the > memory is required. Even in QEMU, the current implementation was > merged without an option to change the generation id on-the-fly. One > must run a new instance in order to set a new value, which means that > no application will be running during that time. The point is still that it changes without an application or the kernel doing anything. > >> > 2. Userspace needs to be able to read these without > >> > system calls. > >> > >> Ick, what? Why not? > >> > >> > Pls add mmap support to the raw format. > >> > >> For a single integer? Why do you need mmap for this? What is so > >> "performant" that needs to touch a sysfs file? > >> > (Phys address is not guaranteed to be page-aligned so you will > >> > probably want an offset attribute for that as well). > >> > >> Ick ick ick, that's why it's good to just stick with a sysfs file. > > I agree with Greg here. The user is able to read the value, and then > wait for a notification if she cares about changes. OK. Patch has to implement notifications for this to work though. That's missing. > >> Have you tested just how long this takes to see if the open/read/close > >> is really the bottleneck, or if the io on reading the value is the > >> bottleneck? > >> > >> thanks, > >> > >> greg k-h > > > > Well an application needs to check this value basically after > > every database transaction. So I'm pretty sure it's a performance > > sensitive path. But yes, I didn't profile any apps since they > > are yet to be written to use this interface. > > I'm fine deferring point 2 for now. > > > > -- > > MST > > Thanks, > > Gal.