Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1638424iob; Thu, 19 May 2022 10:49:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxjRR8xGsimZOPYR8Yujm831dNXrkSJ3xF8pGBTMHQbPB2D2+GfeSe8uzaascrkeNmynNbn X-Received: by 2002:aa7:d898:0:b0:42a:af71:dc24 with SMTP id u24-20020aa7d898000000b0042aaf71dc24mr6711270edq.162.1652982582919; Thu, 19 May 2022 10:49:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652982582; cv=none; d=google.com; s=arc-20160816; b=SR9hsRz3ndoJUkRbtq8DGF1wXaa7Vvflw6153mm68YSu1sVOC9uhjmLT7CwYIShiCf NEFnX645GnLAgM8rPzfJeeY/GRfJEkonYYMKWAmLoz4OrHVPZ7wY5cu80Bl5KPXuGpXf jv7Sgb3gy0TxUDYdAXRkarf4saXdTaIu/bj4es6pX5EJhnJSEjv1dfjvfR67Vnb2hqtt fwUeLqIij/3NEfI8jeQWEL10FCeDhM31RSiYgmNaxocNuygghdC0QcCRd5zCyCYH+c/T eKNqxuxzyvKSQ9/ngJK4KSuE1nf3yAZMA4Wc6/PnBvYPutY2BY+nGLXuMF8Zrhm3Myig kftA== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=4592P8caqsLbBXSwqCd7azgHUUtDxpfkl8BDz2lklMc=; b=jI6yH/9oKMghuRaNdry7RSqC/cZLYBoILxSqFe9JDLPGm/Z0eBKdIfNhK1hyfbla4i 3EMM8uMSQKWxfCWaf8HQDCN4wmpLmnijcT+1GPIpmN8LEP0o/I7LoLxOJZpjToaHOktY 08O1QZCt+mr3Wk9FBBEtv6QntXUcJmsXR03SNlv6FytwHi/f+LmYnOI5bN1hjHLajoyp VK9YoaUX4D5TFsofDjZ/ZJQjInlBIexUjnTwX0x0+THwTUHqmnpDZ6jf4CVn2626Irae sqPg1ENL/6qNdgG50OES7G0IDiBlgTYDfVX9C03CaUMlj9LlF33yaxE1FcM1uaQvWP0Z +Ehg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Ky86F/CF"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cs19-20020a170906dc9300b006efe546a91esi748781ejc.140.2022.05.19.10.49.16; Thu, 19 May 2022 10:49:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Ky86F/CF"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S239800AbiESOcB (ORCPT + 99 others); Thu, 19 May 2022 10:32:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38160 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239789AbiESOb4 (ORCPT ); Thu, 19 May 2022 10:31:56 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A58FF719F3 for ; Thu, 19 May 2022 07:31:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1652970713; 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; bh=4592P8caqsLbBXSwqCd7azgHUUtDxpfkl8BDz2lklMc=; b=Ky86F/CF9/E+GSU6MkzUqYxGTIjaUCT1OzIXiavjrKeTtk0Dota1K4VZYoSRXBtCmE3IT0 TNtCP8P6zZvcnVDvX1DXYYjcJ4hUygftET8StmR+bF55cgRpyPvLKZZ3IVUFmmvjP3Kq1G KIpvflid2jbEF8oONEcE5cz+cdwXUZ4= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-458-kWuMFNf6PRaLvIr2OjGyig-1; Thu, 19 May 2022 10:31:50 -0400 X-MC-Unique: kWuMFNf6PRaLvIr2OjGyig-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 101D080088A; Thu, 19 May 2022 14:31:50 +0000 (UTC) Received: from eperezma.remote.csb (unknown [10.39.193.126]) by smtp.corp.redhat.com (Postfix) with ESMTP id D855040CF8ED; Thu, 19 May 2022 14:31:47 +0000 (UTC) From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= To: mst@redhat.com, jasowang@redhat.com Cc: linux-kernel@vger.kernel.org, sgarzare@redhat.com, gdawar@xilinx.com, lingshan.zhu@intel.com, kvm@vger.kernel.org, lulu@redhat.com, netdev@vger.kernel.org, lvivier@redhat.com, eli@mellanox.com, virtualization@lists.linux-foundation.org, parav@nvidia.com Subject: [PATCH] vdpasim: allow to enable a vq repeatedly Date: Thu, 19 May 2022 16:31:45 +0200 Message-Id: <20220519143145.767845-1-eperezma@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Code must be resilient to enable a queue many times. At the moment the queue is resetting so it's definitely not the expected behavior. Fixes: 2c53d0f64c06 ("vdpasim: vDPA device simulator") Cc: stable@vger.kernel.org Signed-off-by: Eugenio PĂ©rez --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim.c b/drivers/vdpa/vdpa_sim/vdpa_sim.c index ddbe142af09a..b53cd00ad161 100644 --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c @@ -355,9 +355,10 @@ static void vdpasim_set_vq_ready(struct vdpa_device *vdpa, u16 idx, bool ready) struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx]; spin_lock(&vdpasim->lock); - vq->ready = ready; - if (vq->ready) + if (!vq->ready) { + vq->ready = ready; vdpasim_queue_ready(vdpasim, idx); + } spin_unlock(&vdpasim->lock); } -- 2.27.0