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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 339DDC433F5 for ; Wed, 6 Oct 2021 12:15:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 15F8E610A8 for ; Wed, 6 Oct 2021 12:15:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238452AbhJFMRJ (ORCPT ); Wed, 6 Oct 2021 08:17:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:50967 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238440AbhJFMRI (ORCPT ); Wed, 6 Oct 2021 08:17:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633522516; 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=qnmDIGptsktOkioDWWXCssVddVdWstmqHBWueCna4kc=; b=cKiG+WOybh2sZ2ZsquOVXREOamLakQY0NRF5kFPQpIHmLAar0SumRuYLGIjv4rjBwgZ1Et gHXDMaFILOaRQLrS39E0aScUeTgvnUgqIoJYuKrhdH8LsqWTo7i++0Q/wte9m262C6g2Fz cGVnXJuOXLIvsaCRD2dWgl8Ph3UPXmM= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-199-JG7vr57mPZ-xdOa8PYN8tQ-1; Wed, 06 Oct 2021 08:15:15 -0400 X-MC-Unique: JG7vr57mPZ-xdOa8PYN8tQ-1 Received: by mail-ed1-f69.google.com with SMTP id c8-20020a50d648000000b003daa53c7518so2398284edj.21 for ; Wed, 06 Oct 2021 05:15:14 -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:references :mime-version:content-disposition:in-reply-to; bh=qnmDIGptsktOkioDWWXCssVddVdWstmqHBWueCna4kc=; b=cPnmWcAeSIbFRZPOtmRurWYdA8B9ZT7TZ8vw6E2aRYgqlho9CTCIrGHNYrKs6p+89/ B1tQXWeFY52EOjidqvRZDF2TiEpC8mudcRLIpO/rJ5L+ZpubLuLbMiDampvZf2xLnMxR hd7UvPW3ue23miucKhzNHIKDA1viFeeqqNAFN5MsMEEmIg3MGa4yxmC+UkUlerUrizpd WRZFV79kEndvX4BE1zAdXZ2tzQ8auTpXMOY51KLxl3dNH9772mNSm9XVTJUXxZu8RR0b UEnBSn/o+4CrdytXs6DH75chXhMHTVH/Pw4QNgd7FfF73jYU+D8PtwCwZBzcv8QPHvEc ChyA== X-Gm-Message-State: AOAM533DroPOP2cqWiGzaka7Ce4Dn7Bi9rNu/l96BaTQKnLa9XtnwWBL kRcJp+47O9xL0SkvyBcZ1h86EVCXqyrY9lIxMOAP6dYipPby/cw9fjHe4Krpj1Nc3WS0QZOExo3 bEyVsg5xg3olCGsWHio9HRw== X-Received: by 2002:a17:906:f208:: with SMTP id gt8mr21806747ejb.522.1633522513831; Wed, 06 Oct 2021 05:15:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwG9wllx9y16DQrS76uUlfwpX+3oqTEzh8ajeSft32BLV8/8AcXlKmgVAU0xygywoNNmIYASA== X-Received: by 2002:a17:906:f208:: with SMTP id gt8mr21806715ejb.522.1633522513589; Wed, 06 Oct 2021 05:15:13 -0700 (PDT) Received: from redhat.com ([2.55.147.134]) by smtp.gmail.com with ESMTPSA id k20sm8795905ejd.33.2021.10.06.05.15.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 05:15:12 -0700 (PDT) Date: Wed, 6 Oct 2021 08:15:08 -0400 From: "Michael S. Tsirkin" To: Cornelia Huck Cc: Halil Pasic , Jason Wang , Xie Yongji , virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, markver@us.ibm.com, Christian Borntraeger , linux-s390@vger.kernel.org, qemu-devel@nongnu.org Subject: Re: [RFC PATCH 1/1] virtio: write back features before verify Message-ID: <20211006081430-mutt-send-email-mst@kernel.org> References: <20210930070444-mutt-send-email-mst@kernel.org> <20211001092125.64fef348.pasic@linux.ibm.com> <20211002055605-mutt-send-email-mst@kernel.org> <87bl452d90.fsf@redhat.com> <20211004090018-mutt-send-email-mst@kernel.org> <875yuc3ln2.fsf@redhat.com> <20211004110537-mutt-send-email-mst@kernel.org> <87wnms23hn.fsf@redhat.com> <20211004151408-mutt-send-email-mst@kernel.org> <87sfxezcjp.fsf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87sfxezcjp.fsf@redhat.com> Precedence: bulk List-ID: X-Mailing-List: linux-s390@vger.kernel.org On Wed, Oct 06, 2021 at 12:13:14PM +0200, Cornelia Huck wrote: > On Mon, Oct 04 2021, "Michael S. Tsirkin" wrote: > > > On Mon, Oct 04, 2021 at 05:50:44PM +0200, Cornelia Huck wrote: > >> On Mon, Oct 04 2021, "Michael S. Tsirkin" wrote: > >> > >> > On Mon, Oct 04, 2021 at 04:33:21PM +0200, Cornelia Huck wrote: > >> >> On Mon, Oct 04 2021, "Michael S. Tsirkin" wrote: > >> >> > >> >> > On Mon, Oct 04, 2021 at 02:19:55PM +0200, Cornelia Huck wrote: > >> >> >> > >> >> >> [cc:qemu-devel] > >> >> >> > >> >> >> On Sat, Oct 02 2021, "Michael S. Tsirkin" wrote: > >> >> >> > >> >> >> > ok so that's a QEMU bug. Any virtio 1.0 and up > >> >> >> > compatible device must use LE. > >> >> >> > It can also present a legacy config space where the > >> >> >> > endian depends on the guest. > >> >> >> > >> >> >> So, how is the virtio core supposed to determine this? A > >> >> >> transport-specific callback? > >> >> > > >> >> > I'd say a field in VirtIODevice is easiest. > >> >> > >> >> The transport needs to set this as soon as it has figured out whether > >> >> we're using legacy or not. > >> > > >> > Basically on each device config access? > >> > >> Prior to the first one, I think. It should not change again, should it? > > > > Well yes but we never prohibited someone from poking at both .. > > Doing it on each access means we don't have state to migrate. > > Yes; if it isn't too high overhead, that's probably the safest way to > handle it. > > > > >> > > >> >> I guess we also need to fence off any > >> >> accesses respectively error out the device if the driver tries any > >> >> read/write operations that would depend on that knowledge? > >> >> > >> >> And using a field in VirtIODevice would probably need some care when > >> >> migrating. Hm... > >> > > >> > It's just a shorthand to minimize changes. No need to migrate I think. > >> > >> If we migrate in from an older QEMU, we don't know whether we are > >> dealing with legacy or not, until feature negotiation is already > >> done... don't we have to ask the transport? > > > > Right but the only thing that can happen is config access. > > Checking on each config space access would be enough then. > > > Well and for legacy a kick I guess. > > I think any driver that does something that is not config space access, > status access, or feature bit handling without VERSION_1 being set is > neccessarily legacy? Does that really need special handling? Likely not, I just wanted to be exact. -- MST 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 544CBC433EF for ; Wed, 6 Oct 2021 12:15:22 +0000 (UTC) Received: from smtp4.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (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 E0B0E61163 for ; Wed, 6 Oct 2021 12:15:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E0B0E61163 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by smtp4.osuosl.org (Postfix) with ESMTP id AC04B404D6; Wed, 6 Oct 2021 12:15:21 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp4.osuosl.org ([127.0.0.1]) by localhost (smtp4.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 08aXBzatgnT2; Wed, 6 Oct 2021 12:15:20 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by smtp4.osuosl.org (Postfix) with ESMTPS id 412084060C; Wed, 6 Oct 2021 12:15:20 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 10511C000F; Wed, 6 Oct 2021 12:15:20 +0000 (UTC) Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 80711C000D for ; Wed, 6 Oct 2021 12:15:18 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 7DAB183EE7 for ; Wed, 6 Oct 2021 12:15:18 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp1.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rwG-IocWE9ST for ; Wed, 6 Oct 2021 12:15:17 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id B83FA83EDA for ; Wed, 6 Oct 2021 12:15:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633522516; 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=qnmDIGptsktOkioDWWXCssVddVdWstmqHBWueCna4kc=; b=cKiG+WOybh2sZ2ZsquOVXREOamLakQY0NRF5kFPQpIHmLAar0SumRuYLGIjv4rjBwgZ1Et gHXDMaFILOaRQLrS39E0aScUeTgvnUgqIoJYuKrhdH8LsqWTo7i++0Q/wte9m262C6g2Fz cGVnXJuOXLIvsaCRD2dWgl8Ph3UPXmM= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-313-DPfBAgFdNGqavmontHfqTw-1; Wed, 06 Oct 2021 08:15:14 -0400 X-MC-Unique: DPfBAgFdNGqavmontHfqTw-1 Received: by mail-ed1-f69.google.com with SMTP id g28-20020a50d0dc000000b003dae69dfe3aso2458074edf.7 for ; Wed, 06 Oct 2021 05:15:14 -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:references :mime-version:content-disposition:in-reply-to; bh=qnmDIGptsktOkioDWWXCssVddVdWstmqHBWueCna4kc=; b=T50j904xZ5v58Ck3DP36YtLIuyA4/7x40+djxPEzsGPu6Wh/7gjvtJ5eUFilyri1aS j5KobWv86LUUa9dPOiwzb4khkJLN/rpHcZRa3zR7OqgzOamnGB8ny1DMNPkWoXzIBt83 zWTyQQm7SW0DxqLFtcJgRG80YCfhQ5/fnYjFV6rw9TuZnULjLuhbt7kMkZf0bJbuSPDz rvc8ZuizIIX64xcvrYA8yQef9Zu6K1JsUMpvbQ/8wX5d6/FoA9J/U24ZHaFAIm5+4XAa XhFRFazSvC34wPeF48ytqpl30rP9a4saNoBIUJvCYMn+LKVhI2j0a2GNvu8WlZZ6Yiqo dxlA== X-Gm-Message-State: AOAM530dhSTYJWH2kVao8m90v4c9U09X2MAO8lvDSKkrt8HvpLV202co 1yeh+gV+DTbwmL+Zpja2Z9y5UBmc6IH2zy7WBYLmYoWCvJTPIoJhnmqTShEyoeFovYfmFez1nRu wo27moH+estNzpR2OU3ERqYQoGD3fK8keVv1IuyF1Mg== X-Received: by 2002:a17:906:f208:: with SMTP id gt8mr21806745ejb.522.1633522513831; Wed, 06 Oct 2021 05:15:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwG9wllx9y16DQrS76uUlfwpX+3oqTEzh8ajeSft32BLV8/8AcXlKmgVAU0xygywoNNmIYASA== X-Received: by 2002:a17:906:f208:: with SMTP id gt8mr21806715ejb.522.1633522513589; Wed, 06 Oct 2021 05:15:13 -0700 (PDT) Received: from redhat.com ([2.55.147.134]) by smtp.gmail.com with ESMTPSA id k20sm8795905ejd.33.2021.10.06.05.15.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 05:15:12 -0700 (PDT) Date: Wed, 6 Oct 2021 08:15:08 -0400 From: "Michael S. Tsirkin" To: Cornelia Huck Subject: Re: [RFC PATCH 1/1] virtio: write back features before verify Message-ID: <20211006081430-mutt-send-email-mst@kernel.org> References: <20210930070444-mutt-send-email-mst@kernel.org> <20211001092125.64fef348.pasic@linux.ibm.com> <20211002055605-mutt-send-email-mst@kernel.org> <87bl452d90.fsf@redhat.com> <20211004090018-mutt-send-email-mst@kernel.org> <875yuc3ln2.fsf@redhat.com> <20211004110537-mutt-send-email-mst@kernel.org> <87wnms23hn.fsf@redhat.com> <20211004151408-mutt-send-email-mst@kernel.org> <87sfxezcjp.fsf@redhat.com> MIME-Version: 1.0 In-Reply-To: <87sfxezcjp.fsf@redhat.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline Cc: linux-s390@vger.kernel.org, markver@us.ibm.com, Christian Borntraeger , qemu-devel@nongnu.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Halil Pasic , Xie Yongji X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" On Wed, Oct 06, 2021 at 12:13:14PM +0200, Cornelia Huck wrote: > On Mon, Oct 04 2021, "Michael S. Tsirkin" wrote: > > > On Mon, Oct 04, 2021 at 05:50:44PM +0200, Cornelia Huck wrote: > >> On Mon, Oct 04 2021, "Michael S. Tsirkin" wrote: > >> > >> > On Mon, Oct 04, 2021 at 04:33:21PM +0200, Cornelia Huck wrote: > >> >> On Mon, Oct 04 2021, "Michael S. Tsirkin" wrote: > >> >> > >> >> > On Mon, Oct 04, 2021 at 02:19:55PM +0200, Cornelia Huck wrote: > >> >> >> > >> >> >> [cc:qemu-devel] > >> >> >> > >> >> >> On Sat, Oct 02 2021, "Michael S. Tsirkin" wrote: > >> >> >> > >> >> >> > ok so that's a QEMU bug. Any virtio 1.0 and up > >> >> >> > compatible device must use LE. > >> >> >> > It can also present a legacy config space where the > >> >> >> > endian depends on the guest. > >> >> >> > >> >> >> So, how is the virtio core supposed to determine this? A > >> >> >> transport-specific callback? > >> >> > > >> >> > I'd say a field in VirtIODevice is easiest. > >> >> > >> >> The transport needs to set this as soon as it has figured out whether > >> >> we're using legacy or not. > >> > > >> > Basically on each device config access? > >> > >> Prior to the first one, I think. It should not change again, should it? > > > > Well yes but we never prohibited someone from poking at both .. > > Doing it on each access means we don't have state to migrate. > > Yes; if it isn't too high overhead, that's probably the safest way to > handle it. > > > > >> > > >> >> I guess we also need to fence off any > >> >> accesses respectively error out the device if the driver tries any > >> >> read/write operations that would depend on that knowledge? > >> >> > >> >> And using a field in VirtIODevice would probably need some care when > >> >> migrating. Hm... > >> > > >> > It's just a shorthand to minimize changes. No need to migrate I think. > >> > >> If we migrate in from an older QEMU, we don't know whether we are > >> dealing with legacy or not, until feature negotiation is already > >> done... don't we have to ask the transport? > > > > Right but the only thing that can happen is config access. > > Checking on each config space access would be enough then. > > > Well and for legacy a kick I guess. > > I think any driver that does something that is not config space access, > status access, or feature bit handling without VERSION_1 being set is > neccessarily legacy? Does that really need special handling? Likely not, I just wanted to be exact. -- MST _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D91F3C433EF for ; Wed, 6 Oct 2021 12:18:41 +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 03431610A2 for ; Wed, 6 Oct 2021 12:18:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 03431610A2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:36890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mY5sb-0002M0-Qo for qemu-devel@archiver.kernel.org; Wed, 06 Oct 2021 08:18:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:55630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mY5pU-0000CB-Rm for qemu-devel@nongnu.org; Wed, 06 Oct 2021 08:15:25 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:41686) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mY5pQ-0004Xp-GR for qemu-devel@nongnu.org; Wed, 06 Oct 2021 08:15:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633522518; 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=qnmDIGptsktOkioDWWXCssVddVdWstmqHBWueCna4kc=; b=e8boHo6aeTdfkgaawTFi9qs10EDRfbhsKQt8pM8ywQACN3avn3WuFkrxc1fJEF6alhJGT8 1Rd9BRvb2fYrKylioJRnRmqEJR51WZX+G60GZMbB3GyzcGzlKh9FwVm/L+gLcyXMfeGA90 GDiMgaU5erzW7Sx6oON45P+Q08q36VY= Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-35-ZlcQyQ4mNeiak3p0-XPREA-1; Wed, 06 Oct 2021 08:15:15 -0400 X-MC-Unique: ZlcQyQ4mNeiak3p0-XPREA-1 Received: by mail-ed1-f69.google.com with SMTP id w6-20020a50d786000000b003dabc563406so2413391edi.17 for ; Wed, 06 Oct 2021 05:15:14 -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:references :mime-version:content-disposition:in-reply-to; bh=qnmDIGptsktOkioDWWXCssVddVdWstmqHBWueCna4kc=; b=E0OfR1N7pSuN/yKeDwx7qhg13Yt35mIC9HAGUZv/dPk35xhwriHLrCsgsuQ39r+Yvs 36y9z1dM0SM2epcDMxKJQl/+GzftMp4BaR/w/GvLjyzRSB8YjEshP+WlekDVqUdFh6Na Ps3aMtmRgN+LQVgy5pxFr9qbo3ifvVzxPCsErT5jqkD7vhVNAHamIPvCzwZ4V6iTFr/V XSYGGOFCh8clZ+zrWz/oI8+WpMhY56cXuiALjd9++wPX5+uJ6ufBNesY/Zh50eF+V4fY +ZwgZe6VvAn64vgE2cDOf9hZAmX+oABoF34ZfXlmhVbIXFWZa4J/lIDC/GjgcTsysRZi DmuQ== X-Gm-Message-State: AOAM530qn6CxtEVT1gVdKh2Hrb1411+H4zneviFzIweovaeWDvj8maJi wCXYjHYfRqer+fHm9n8oZ4D37zOrEjsB/EdWqHB+UJIh/mijTliW9tWtGY7MWcjS5KDPUn5byOa bgef4JZTp65rEGOU= X-Received: by 2002:a17:906:f208:: with SMTP id gt8mr21806751ejb.522.1633522513832; Wed, 06 Oct 2021 05:15:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwG9wllx9y16DQrS76uUlfwpX+3oqTEzh8ajeSft32BLV8/8AcXlKmgVAU0xygywoNNmIYASA== X-Received: by 2002:a17:906:f208:: with SMTP id gt8mr21806715ejb.522.1633522513589; Wed, 06 Oct 2021 05:15:13 -0700 (PDT) Received: from redhat.com ([2.55.147.134]) by smtp.gmail.com with ESMTPSA id k20sm8795905ejd.33.2021.10.06.05.15.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Oct 2021 05:15:12 -0700 (PDT) Date: Wed, 6 Oct 2021 08:15:08 -0400 From: "Michael S. Tsirkin" To: Cornelia Huck Subject: Re: [RFC PATCH 1/1] virtio: write back features before verify Message-ID: <20211006081430-mutt-send-email-mst@kernel.org> References: <20210930070444-mutt-send-email-mst@kernel.org> <20211001092125.64fef348.pasic@linux.ibm.com> <20211002055605-mutt-send-email-mst@kernel.org> <87bl452d90.fsf@redhat.com> <20211004090018-mutt-send-email-mst@kernel.org> <875yuc3ln2.fsf@redhat.com> <20211004110537-mutt-send-email-mst@kernel.org> <87wnms23hn.fsf@redhat.com> <20211004151408-mutt-send-email-mst@kernel.org> <87sfxezcjp.fsf@redhat.com> MIME-Version: 1.0 In-Reply-To: <87sfxezcjp.fsf@redhat.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mst@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Received-SPF: pass client-ip=170.10.129.124; envelope-from=mst@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.05, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-s390@vger.kernel.org, markver@us.ibm.com, Christian Borntraeger , qemu-devel@nongnu.org, Jason Wang , linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, Halil Pasic , Xie Yongji Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Wed, Oct 06, 2021 at 12:13:14PM +0200, Cornelia Huck wrote: > On Mon, Oct 04 2021, "Michael S. Tsirkin" wrote: > > > On Mon, Oct 04, 2021 at 05:50:44PM +0200, Cornelia Huck wrote: > >> On Mon, Oct 04 2021, "Michael S. Tsirkin" wrote: > >> > >> > On Mon, Oct 04, 2021 at 04:33:21PM +0200, Cornelia Huck wrote: > >> >> On Mon, Oct 04 2021, "Michael S. Tsirkin" wrote: > >> >> > >> >> > On Mon, Oct 04, 2021 at 02:19:55PM +0200, Cornelia Huck wrote: > >> >> >> > >> >> >> [cc:qemu-devel] > >> >> >> > >> >> >> On Sat, Oct 02 2021, "Michael S. Tsirkin" wrote: > >> >> >> > >> >> >> > ok so that's a QEMU bug. Any virtio 1.0 and up > >> >> >> > compatible device must use LE. > >> >> >> > It can also present a legacy config space where the > >> >> >> > endian depends on the guest. > >> >> >> > >> >> >> So, how is the virtio core supposed to determine this? A > >> >> >> transport-specific callback? > >> >> > > >> >> > I'd say a field in VirtIODevice is easiest. > >> >> > >> >> The transport needs to set this as soon as it has figured out whether > >> >> we're using legacy or not. > >> > > >> > Basically on each device config access? > >> > >> Prior to the first one, I think. It should not change again, should it? > > > > Well yes but we never prohibited someone from poking at both .. > > Doing it on each access means we don't have state to migrate. > > Yes; if it isn't too high overhead, that's probably the safest way to > handle it. > > > > >> > > >> >> I guess we also need to fence off any > >> >> accesses respectively error out the device if the driver tries any > >> >> read/write operations that would depend on that knowledge? > >> >> > >> >> And using a field in VirtIODevice would probably need some care when > >> >> migrating. Hm... > >> > > >> > It's just a shorthand to minimize changes. No need to migrate I think. > >> > >> If we migrate in from an older QEMU, we don't know whether we are > >> dealing with legacy or not, until feature negotiation is already > >> done... don't we have to ask the transport? > > > > Right but the only thing that can happen is config access. > > Checking on each config space access would be enough then. > > > Well and for legacy a kick I guess. > > I think any driver that does something that is not config space access, > status access, or feature bit handling without VERSION_1 being set is > neccessarily legacy? Does that really need special handling? Likely not, I just wanted to be exact. -- MST