Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2212393iof; Tue, 7 Jun 2022 23:22:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZ4KmFKuOoI9+8088x9sMZBfjfdU9tvxEt6VDUCHoxIbOHY3Njtw0O77hjTX7d8TznMryn X-Received: by 2002:a65:6e05:0:b0:3da:eb74:ef9c with SMTP id bd5-20020a656e05000000b003daeb74ef9cmr29234921pgb.563.1654669326603; Tue, 07 Jun 2022 23:22:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654669326; cv=none; d=google.com; s=arc-20160816; b=rU9/19EoMN1xYKmrGGc89+xfgwMQHP9NAolJ5d+ZowES052J5qOOjp3tmFfJtJmbm/ qfIMhjQGYV/vjoxZw+bgX9hhnq8RhtgrIqlMeyhcOmyMP7pz/onyJE7W1OBKArjCqfsW jOP6oTY4LB1bRI2mdH+5jLQOh17LQ5J3sthZucNm6r9ocinXQdDQyBKPI2QH9ImoC9rb 64f0mTOsT8RZAnhOmiq95nlYg5PAAoQyd/0c8vXy/DAPIRL3qR7c9Ha/R59qPlH60VnX VVnrmPkc81kEtfiDx5RgO2A4z6ptRhbbP/O4GxfpWeRfDStNFTTppiZWFafQvsBRbqgX xeUw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0K82IFni7lrtFiApf8HAQxzD5Snj/SmzenW6GTE3uWg=; b=Y5kv5Xb5QigXrwS67/6D4EAPZwWHia4chRX3VBxn2NEw5Da90AVWrAHdyzh7mugNfm b6SJxx4QJ6+8FruBIE9ncyGF+DWl5z64OqIWt7dvNKY4v0MpqcHx8HQRt8erI6cQfOXH 1ZPXwKEzOF/f1PWwmjiNTJZmL/JJRmSoakS7Rzw6oQbWYeuUf9y1fzoDM94+Kk8jLFhd lzO4834iRT3yvvyqtYI/rGW00josJnW6voshqZcW3YjxTXKeKTZDkCCKMOkEaRNfhRma iUUj0G6zACU/Qqe0zsZ3+fvrQea0qOf5IziXZe1GmgTcWW4pBWNuTdv6j6nmpdvYV97r 7gtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k4FjkMYB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id p1-20020a170902e74100b0016213dc7805si24151031plf.324.2022.06.07.23.22.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:22:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=k4FjkMYB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 0CF4B15A75D; Tue, 7 Jun 2022 22:42:42 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443747AbiFHCDH (ORCPT + 99 others); Tue, 7 Jun 2022 22:03:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1843649AbiFHALR (ORCPT ); Tue, 7 Jun 2022 20:11:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72B4C19EC08; Tue, 7 Jun 2022 12:26:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0D38660C7F; Tue, 7 Jun 2022 19:26:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 13CCDC385A5; Tue, 7 Jun 2022 19:26:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629979; bh=WQOEOZu+GFtit9nfZ0CRil1D8zDpzePz2KgoVdWnlhA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k4FjkMYB7yPyJ1sdJXVrqtfU5QdNJHklbClfeA8xi6bsZBM4r7re/BX35HrrkECM6 PA6aHoCLVfeSsFWBH2jmED4R/rkuIfo37kJKAJ4+0c1yIVOVy9dbELhFFbyko4o533 TdBhKxQm5/LxOBKMKaHookKsHowQZbFcqCmYiKsE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, =?UTF-8?q?Eugenio=20P=C3=A9rez?= , "Michael S. Tsirkin" , Stefano Garzarella Subject: [PATCH 5.18 857/879] vdpasim: allow to enable a vq repeatedly Date: Tue, 7 Jun 2022 19:06:15 +0200 Message-Id: <20220607165027.730597397@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_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 From: Eugenio Pérez commit 242436973831aa97e8ce19533c6c912ea8def31b upstream. 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. v2: set vq->ready = 0 at disable. Fixes: 2c53d0f64c06 ("vdpasim: vDPA device simulator") Cc: stable@vger.kernel.org Signed-off-by: Eugenio Pérez Message-Id: <20220519145919.772896-1-eperezma@redhat.com> Signed-off-by: Michael S. Tsirkin Reviewed-by: Stefano Garzarella Signed-off-by: Greg Kroah-Hartman --- drivers/vdpa/vdpa_sim/vdpa_sim.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/vdpa/vdpa_sim/vdpa_sim.c +++ b/drivers/vdpa/vdpa_sim/vdpa_sim.c @@ -353,11 +353,14 @@ static void vdpasim_set_vq_ready(struct { struct vdpasim *vdpasim = vdpa_to_sim(vdpa); struct vdpasim_virtqueue *vq = &vdpasim->vqs[idx]; + bool old_ready; spin_lock(&vdpasim->lock); + old_ready = vq->ready; vq->ready = ready; - if (vq->ready) + if (vq->ready && !old_ready) { vdpasim_queue_ready(vdpasim, idx); + } spin_unlock(&vdpasim->lock); }