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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B6764C3DA5D for ; Thu, 25 Jul 2024 21:05:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:In-Reply-To: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tTDtUQaLZ7CrF67TfvKh0JSNTMNAlAQ/IuXCIFvbTU8=; b=EbdL6uOiBywvEKYDQ3o07C3OKm 4oQCyOEFOTxwmB9uHThdQN6BF6FoR4FJ1Nsf2d8wzUfpBtq7ZngNvz7rjnnG8WNRSac/tUuCpO77p twCKgAu3xTYdRMyMGec5gIKUxVMjX04bJTQMy0+aOQ4WhjDtrAyj6/7xMEEOjSEsUdScsy5wxnoH7 EqjPg4u9FOpVcw6vK1/khUkRIUOn1hZaeZZqqT58nhaTg7liEfLbTqd5WcvbO1mgxCrpG9KFmQsfs yCW8HEFPB37fl5VFrCgbZX3MwyTeTYqv/OAeWALUEYskGtKuFSuFTynmNYM9Ck2WhdGrSqxfJQqr7 bdEqMhTw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sX5e5-000000028V5-0Env; Thu, 25 Jul 2024 21:05:05 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sX5df-000000028Oj-3V3h for linux-arm-kernel@lists.infradead.org; Thu, 25 Jul 2024 21:04:41 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1721941478; 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=tTDtUQaLZ7CrF67TfvKh0JSNTMNAlAQ/IuXCIFvbTU8=; b=Hz73QVdYJSgFJ9U9vYr8Cia9eiPCuKUqcojCIQvi/nzkLmVEpEKaAb+EdNRcBNaRjzgVxX 5hYxly59IhviuwPBU/lAs9UKXJVtdajQHd8F8G2dB5rWR7kpYyc/QC+WS0G0s2+h3B2tOm 7eVqJguzNJgCVp3OYsFL9S64cb2L1C8= Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-2-rvUmmMo-Nc2OWmFInWfwGQ-1; Thu, 25 Jul 2024 17:04:37 -0400 X-MC-Unique: rvUmmMo-Nc2OWmFInWfwGQ-1 Received: by mail-wr1-f70.google.com with SMTP id ffacd0b85a97d-369bf135b49so703314f8f.0 for ; Thu, 25 Jul 2024 14:04:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721941476; x=1722546276; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=tTDtUQaLZ7CrF67TfvKh0JSNTMNAlAQ/IuXCIFvbTU8=; b=GboG3MGKIGuo49UTy7imtdtB+YWoz3e7fq1nCOwPFSSr0qsSoU2FnAx2qsl+nINriG xMEyy88ABquTOt09Cqmf6BsWLfcPiVcWx9swBFWJiuzFt5u2U6UXx1U7+9DL1aTa/5RF 207oQxsA9PDrIVJ8u6vaf+tOJhesAjeQUN9zo7xrN7Cqw8YoOenfuv0f1LmfJsmihvnA bydeM6Hkt57qrURzrSya6Uol5/j54lt/Be4F+d09ggX4jc00mUATOA+Myq2T0tFYoUvN 1xs26r0uYXo7gWc5S7Zp1tqiB5veUA9yAGAVljDQ7XJKZ4E2FkOU5EmYnZmnCY/C8eFd joGQ== X-Forwarded-Encrypted: i=1; AJvYcCVDVhRUMhf9AjQgXoGmuqtMNUBVoA1kcEQzX8hAxuMni01cDdu4ytmq5urA3qHXY+5yXe5fdGNfyl5xODHxS5zw2VxVDhqW4qGJvjSQMjE0Pu0FI3o= X-Gm-Message-State: AOJu0YxRMBIFUytGKjoOlYiNDomi11dcmKaepX7MmNN30wQS00l78ea6 kyGLnmg+2ToX/1iSb1GilCnfyozCxU7QhAlQ3INgQqFrbTyM4savNLPkfjknduhD6LERsNblXrv oa/gZclE7XIf2AEW3pM0J/WzKjzTCgRMjnZ62NRj8bQ8FHd6WBYhuVwcwXXZ2v0Aba/u3bLwo X-Received: by 2002:adf:ed90:0:b0:367:8fee:4434 with SMTP id ffacd0b85a97d-36b31b4d48dmr2687322f8f.16.1721941476017; Thu, 25 Jul 2024 14:04:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHhpTnkp42p1F3wTt6Fx20U3s9cQUoElQmJjW+LG0DsT7CR4O+1x/Cg4YZh3CZ7ii4p+45m0A== X-Received: by 2002:adf:ed90:0:b0:367:8fee:4434 with SMTP id ffacd0b85a97d-36b31b4d48dmr2687298f8f.16.1721941475033; Thu, 25 Jul 2024 14:04:35 -0700 (PDT) Received: from redhat.com ([2a02:14f:1f7:28ce:f21a:7e1e:6a9:f708]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36b36863d87sm3172908f8f.110.2024.07.25.14.04.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jul 2024 14:04:34 -0700 (PDT) Date: Thu, 25 Jul 2024 17:04:29 -0400 From: "Michael S. Tsirkin" To: David Woodhouse Cc: Richard Cochran , Peter Hilber , linux-kernel@vger.kernel.org, virtualization@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-rtc@vger.kernel.org, "Ridoux, Julien" , virtio-dev@lists.linux.dev, "Luu, Ryan" , "Chashper, David" , "Mohamed Abuelfotoh, Hazem" , "Christopher S . Hall" , Jason Wang , John Stultz , netdev@vger.kernel.org, Stephen Boyd , Thomas Gleixner , Xuan Zhuo , Marc Zyngier , Mark Rutland , Daniel Lezcano , Alessandro Zummo , Alexandre Belloni , qemu-devel , Simon Horman Subject: Re: [PATCH] ptp: Add vDSO-style vmclock support Message-ID: <20240725170328-mutt-send-email-mst@kernel.org> References: <20240725082828-mutt-send-email-mst@kernel.org> <20240725083215-mutt-send-email-mst@kernel.org> <98813a70f6d3377d3a9d502fd175be97334fcc87.camel@infradead.org> <20240725100351-mutt-send-email-mst@kernel.org> <2a27205bfc61e19355d360f428a98e2338ff68c3.camel@infradead.org> <20240725122603-mutt-send-email-mst@kernel.org> <0959390cad71b451dc19e5f9396d3f4fdb8fd46f.camel@infradead.org> <20240725163843-mutt-send-email-mst@kernel.org> MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240725_140439_975564_E53C3714 X-CRM114-Status: GOOD ( 44.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jul 25, 2024 at 10:00:24PM +0100, David Woodhouse wrote: > On Thu, 2024-07-25 at 16:50 -0400, Michael S. Tsirkin wrote: > > On Thu, Jul 25, 2024 at 08:35:40PM +0100, David Woodhouse wrote: > > > On Thu, 2024-07-25 at 12:38 -0400, Michael S. Tsirkin wrote: > > > > On Thu, Jul 25, 2024 at 04:18:43PM +0100, David Woodhouse wrote: > > > > > The use case isn't necessarily for all users of gettimeofday(), of > > > > > course; this is for those applications which *need* precision time. > > > > > Like distributed databases which rely on timestamps for coherency, and > > > > > users who get fined millions of dollars when LM messes up their clocks > > > > > and they put wrong timestamps on financial transactions. > > > > > > > > I would however worry that with all this pass through, > > > > applications have to be coded to each hypervisor or even > > > > version of the hypervisor. > > > > > > Yes, that would be a problem. Which is why I feel it's so important to > > > harmonise the contents of the shared memory, and I'm implementing it > > > both QEMU and $DAYJOB, as well as aligning with virtio-rtc. > > > > > > Writing an actual spec for this would be another thing that might help. > > > > > > I don't think the structure should be changing between hypervisors (and > > > especially versions). We *will* see a progression from simply providing > > > the disruption signal, to providing the full clock information so that > > > guests don't have to abort transactions while they resync their clock. > > > But that's perfectly fine. > > > > > > And it's also entirely agnostic to the mechanism by which the memory > > > region is *discovered*. It doesn't matter if it's ACPI, DT, a > > > hypervisor enlightenment, a BAR of a simple PCI device, virtio, or > > > anything else. > > > > > > ACPI is one of the *simplest* options for a hypervisor and guest to > > > implement, and doesn't prevent us from using the same structure in > > > virtio-rtc. I'm happy enough using ACPI and letting virtio-rtc come > > > along later. > > > > > > > virtio has been developed with the painful experience that we keep > > > > making mistakes, or coming up with new needed features, > > > > and that maintaining forward and backward compatibility > > > > becomes a whole lot harder than it seems in the beginning. > > > > > > Yes. But as you note, this shared memory structure is a userspace ABI > > > all of its own, so we get to make a completely *different* kind of > > > mistake :) > > > > > > > > > So, something I still don't completely understand. > > Can't the VDSO thing be written to by kernel? > > Let's say on LM, an interrupt triggers and kernel copies > > data from a specific device to the VDSO. > > > > Is that problematic somehow? I imagine there is a race where > > userspace reads vdso after lm but before kernel updated > > vdso - is that the concern? > > > > Then can't we fix it by interrupting all CPUs right after LM? > > > > To me that seems like a cleaner approach - we then compartmentalize > > the ABI issue - kernel has its own ABI against userspace, > > devices have their own ABI against kernel. > > It'd mean we need a way to detect that interrupt was sent, > > maybe yet another counter inside that structure. > > > > WDYT? > > > > By the way the same idea would work for snapshots - > > some people wanted to expose that info to userspace, too. > > > was there supposed to be text here, or did you just like this so much you decided to repost my mail ;) -- MST