Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1084721pxb; Wed, 29 Sep 2021 16:52:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5Aq6aiXWjbqQiOm1aV+uR44lCO/zgE96Locnl/izqqcVMNWndOAybqssHYYs4xshc9x9I X-Received: by 2002:a17:906:3e81:: with SMTP id a1mr3110619ejj.482.1632959522272; Wed, 29 Sep 2021 16:52:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632959522; cv=none; d=google.com; s=arc-20160816; b=tmgKzmpiZ2wWsjIDbR4wcYj+u5Uvs3JY6Qq3D/fe/+YtCQzHUTJeEjydchgKA9VMdz sjCG4d3/5YEqx3h4pNnIwx5uzi9/spYg8sUBU53cRIkSPG1EOFX65/SSgL+iDhdtAR/s 0VQzC7W+zwLd3Ikzje+z1Pg2IDkLOqMlqhYFlJjAXnpJTpKO+2DTvXsTGvEfVspUReQE RTzYoDR4jx8NJx409ddeLgzqhmEa2BSfxXyOWLwDtu3M2UwGl15O0bPd9JgndWvrj3nw cd90ZSRlgzTzBZts4AzgmGokOsYf/kNl7L0ca5G5Y/VekV5481Tb7lRtN0624Q/d6mwB gyFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=yDnZg0/6giW9XllEqIndueSNzorfdQE2gNriGLCrs+s=; b=qRwTwAHdHKLSi9vqTGIFU0GTTh2JC7Usgq/iPHbQG5swzGVX+0wRyBelbh9peqjNZD BUK1LRlE3G8YD3iqgB9FsurrUsGgNBdz+nEd/l8j0CRq7EVeQNVfwjERajyJhQ1D1PtT SNywLy5aPJJmX6qDiE9qckdGW7Y0lIZSXR6bYeKsH7RwPNsasiUF0FuxWu3ahDk+jUnp IMs6AzGAmkl5hbgjePhog+AeHktZ6szOLNj/RPlvNojEV3u2LUzYMNgZVlqdeUPHe9yp yId0J/qdg5OMIAkMFc5qK+N8dvv3TlKpPKBNJbAf7uHTOfMpi3v+McaALN/z3uesGuWR zsCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=PV7kY0JH; 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 md16si1655769ejb.364.2021.09.29.16.51.37; Wed, 29 Sep 2021 16:52:02 -0700 (PDT) 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=PV7kY0JH; 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 S1347306AbhI2Wp7 (ORCPT + 99 others); Wed, 29 Sep 2021 18:45:59 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:50192 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345988AbhI2Wp6 (ORCPT ); Wed, 29 Sep 2021 18:45:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632955453; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=yDnZg0/6giW9XllEqIndueSNzorfdQE2gNriGLCrs+s=; b=PV7kY0JHbqRzJy5V0K5Y6wpr/SmJ8JQ6BKg+AaHZzxnKSNIyerDzyvf4JUWHX0FRRY2C9m XfFMQHEIiz8XOyOpexXqszNUETFKD9z0aktvP0z8HwVHlAW7vYD2Lu+D6vuOsyKlwzgfO/ O0vHw6yfCNXELo9Pm5OpytuVaEPzzOE= Received: from mail-oo1-f72.google.com (mail-oo1-f72.google.com [209.85.161.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-86-H6HA30YbN-qtpXbn9wxV4w-1; Wed, 29 Sep 2021 18:44:12 -0400 X-MC-Unique: H6HA30YbN-qtpXbn9wxV4w-1 Received: by mail-oo1-f72.google.com with SMTP id p82-20020a4a2f55000000b002b584670618so3333774oop.2 for ; Wed, 29 Sep 2021 15:44:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yDnZg0/6giW9XllEqIndueSNzorfdQE2gNriGLCrs+s=; b=1m3xI99Bf1fu23zHqBCCH7/SXyO9hvxQGC4XGkZKOPJ5hwacpBV27z93bSwqVbCoRM ldmMSe6B5ZAf8CU/uj8jUJAQIYDCRlNkOLjr+nR/A1qTwJEzwCB+n6xYg1GnLIlxTKDd B/I+kEVt7aOoMIHa+F5AgmkjhFYhRIovxFhP3FuyApud+X1zzEhUB/dEHNEGOr9JF/dm P5gVdJTONV0TZeQTSFvl6hZ5Yw0kBjbi/ph1uCvWHTAF7orzt7TcjkAm3YgyeyyrNawG ZnqnZO1WbiPIPoF8ptbCmQBpvQDMLTXWuOP3H2EI39jRmtJ9rPdiPugZcq4CzCzPdLRe Aiig== X-Gm-Message-State: AOAM530Pp1O4AfOkAd6ZkVExoksrksbeDQYxRJrrcxem6fCpe2Gp0ljm XEdTq4+A7E0YQiC+avt+H/RUTwvfcitve2ShwvD28gCIrl0t6x9VeS+JE/WsbTPXm5t74XCKAKV ooRqwUXAXC6LDXURsCVlHPVM3 X-Received: by 2002:a05:6808:1595:: with SMTP id t21mr78459oiw.98.1632955451615; Wed, 29 Sep 2021 15:44:11 -0700 (PDT) X-Received: by 2002:a05:6808:1595:: with SMTP id t21mr78446oiw.98.1632955451416; Wed, 29 Sep 2021 15:44:11 -0700 (PDT) Received: from redhat.com ([198.99.80.109]) by smtp.gmail.com with ESMTPSA id d21sm229884ooh.43.2021.09.29.15.44.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 15:44:10 -0700 (PDT) Date: Wed, 29 Sep 2021 16:44:09 -0600 From: Alex Williamson To: Max Gurtovoy Cc: Jason Gunthorpe , Leon Romanovsky , Doug Ledford , Yishai Hadas , Bjorn Helgaas , "David S. Miller" , Jakub Kicinski , Kirti Wankhede , , , , , , Saeed Mahameed , Cornelia Huck Subject: Re: [PATCH mlx5-next 2/7] vfio: Add an API to check migration state transition validity Message-ID: <20210929164409.3c33e311.alex.williamson@redhat.com> In-Reply-To: <29835bf4-d094-ae6d-1a32-08e65847b52c@nvidia.com> References: <20210927164648.1e2d49ac.alex.williamson@redhat.com> <20210927231239.GE3544071@ziepe.ca> <25c97be6-eb4a-fdc8-3ac1-5628073f0214@nvidia.com> <20210929063551.47590fbb.alex.williamson@redhat.com> <1eba059c-4743-4675-9f72-1a26b8f3c0f6@nvidia.com> <20210929075019.48d07deb.alex.williamson@redhat.com> <20210929091712.6390141c.alex.williamson@redhat.com> <20210929161433.GA1808627@ziepe.ca> <29835bf4-d094-ae6d-1a32-08e65847b52c@nvidia.com> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 30 Sep 2021 00:48:55 +0300 Max Gurtovoy wrote: > On 9/29/2021 7:14 PM, Jason Gunthorpe wrote: > > On Wed, Sep 29, 2021 at 06:28:44PM +0300, Max Gurtovoy wrote: > > > >>> So you have a device that's actively modifying its internal state, > >>> performing I/O, including DMA (thereby dirtying VM memory), all while > >>> in the _STOP state? And you don't see this as a problem? > >> I don't see how is it different from vfio-pci situation. > > vfio-pci provides no way to observe the migration state. It isn't > > "000b" > > Alex said that there is a problem of compatibility. > > I migration SW is not involved, nobody will read this migration state. The _STOP state has a specific meaning regardless of whether userspace reads the device state value. I think what you're suggesting is that the device reports itself as _STOP'd but it's actually _RUNNING. Is that the compatibility workaround, create a self inconsistency? We cannot impose on userspace to move a device from _STOP to _RUNNING simply because the device supports the migration region, nor should we report a device state that is inconsistent with the actual device state. > >> Maybe we need to rename STOP state. We can call it READY or LIVE or > >> NON_MIGRATION_STATE. > > It was a poor choice to use 000b as stop, but it doesn't really > > matter. The mlx5 driver should just pre-init this readable to running. > > I guess we can do it for this reason. There is no functional problem nor > compatibility issue here as was mentioned. > > But still we need the kernel to track transitions. We don't want to > allow moving from RESUMING to SAVING state for example. How this > transition can be allowed ? > > In this case we need to fail the request from the migration SW... _RESUMING to _SAVING seems like a good way to test round trip migration without running the device to modify the state. Potentially it's a means to update a saved device migration data stream to a newer format using an intermediate driver version. If a driver is written such that it simply sees clearing the _RESUME bit as an indicator to de-serialize the data stream to the device, and setting the _SAVING flag as an indicator to re-serialize that data stream from the device, then this is just a means to make use of existing data paths. The uAPI specifies a means for drivers to reject a state change, but that risks failing to support a transition which might find mainstream use cases. I don't think common code should be responsible for filtering out viable transitions. Thanks, Alex