Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1012940rwe; Wed, 24 Aug 2022 13:10:45 -0700 (PDT) X-Google-Smtp-Source: AA6agR5W7KyRidvuEP7AH4l5ZWCYZJ9Qqrw5HDWs/bEmqAH3kDnW2Q+QLRzNBbljzeUbpRVtdKpY X-Received: by 2002:a17:907:b1b:b0:73d:b5c9:192c with SMTP id h27-20020a1709070b1b00b0073db5c9192cmr346400ejl.393.1661371844810; Wed, 24 Aug 2022 13:10:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661371844; cv=none; d=google.com; s=arc-20160816; b=E/rI+WwzWbZvJtw0mx+MDC0HLGvYvvHx+6PfDnJvACs1Wirafvmh+Lx904+MhUIRA7 13uJlKFGgofb4EcfSZquy4WoaK//s2uEfrrTN0yBJ7qIzlB/jY0JPcapEhyyah18FL9X LYJJKTzjlIbbai7cck5AQwYvjBPxGjm+eqiEVTkOdXNN6mCiCjlgitKI0lqTWoP5YB19 HePtH+eBGlb9y5nEchcG013kX8m72eoi5qhh8qShPKeDyUh1gMwfRRrk0a7a/qevkq0z 1g6sHVb4jHjBvxKH7hf/dqKhhKir57Zu4VtFknZXDB+MaXWv7tPM6BIEIy+7x4ccsQy+ 9H/A== 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=1madC+R9UQ0sdGYZ6Rb4RFre0WnX4XbXDajpRgvIHys=; b=yNsangRU3e3+vIBUUFSLEIgyA//7ood00/XiXtJj7mcLlpZLskhZcqbIh93BdJo3zc s8V24uA9tgP/kapLNFMm8uZ2KIjgbABMeEwQBFKVxwiG44n+kqTG6hh118AyRsVWqUro o10LEGQiNamS/sQGdG5teGoPDPvr8c8sucRtx7eU8d/ksnvmHmTIIBgnFG7jLsKoYspb dtSEJrmNU+koTePGLvg70fetPO8b1uV7MAgJlOSnuiJ0ce/augtEX1lZVf5otgimMx/E FhShQdjSHBSBKrlFRk5p7ztVKsUDNgjxsbGBszSjlBSR9y6mxYWpm7VCd8pDn30K196g d7TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Q0jxUF2q; 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 hp24-20020a1709073e1800b007316ac034c1si2624771ejc.496.2022.08.24.13.09.38; Wed, 24 Aug 2022 13:10:44 -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=Q0jxUF2q; 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 S239586AbiHXT3Z (ORCPT + 99 others); Wed, 24 Aug 2022 15:29:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239798AbiHXT3U (ORCPT ); Wed, 24 Aug 2022 15:29:20 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89D3178BED for ; Wed, 24 Aug 2022 12:29:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661369357; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=1madC+R9UQ0sdGYZ6Rb4RFre0WnX4XbXDajpRgvIHys=; b=Q0jxUF2qt4yNu/r52wJPQbO2WNwefbiwbf7edZM2dDYYK4oWre6oyt1Wfw6S34IG/Ml941 xdrjOvkrpoZ7UGI2jiO61kcddkTVLv40pdA+7cgli81xcEzpz07XLDsXOnnH9sBUowfRb0 wh6VSG0BDfwBb3JjWQz6qzI5XjbydDU= 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-79-pGYwyQFlM8qip7dsuiawMg-1; Wed, 24 Aug 2022 15:29:16 -0400 X-MC-Unique: pGYwyQFlM8qip7dsuiawMg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E132A18A6507; Wed, 24 Aug 2022 19:29:15 +0000 (UTC) Received: from cantor.redhat.com (unknown [10.2.16.21]) by smtp.corp.redhat.com (Postfix) with ESMTP id 517FB492C3B; Wed, 24 Aug 2022 19:29:15 +0000 (UTC) From: Jerry Snitselaar To: linux-kernel@vger.kernel.org Cc: Fenghua Yu , Dave Jiang , Vinod Koul , dmaengine@vger.kernel.org Subject: [PATCH] dmaengine: idxd: Set workqueue state to disabled before trying to re-enable Date: Wed, 24 Aug 2022 12:29:13 -0700 Message-Id: <20220824192913.2425634-1-jsnitsel@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 X-Spam-Status: No, score=-2.8 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=ham 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 For a software reset idxd_device_reinit() is called, which will walk the device workqueues to see which ones were enabled, and try to re-enable them. It keys off wq->state being iDXD_WQ_ENABLED, but the first thing idxd_enable_wq() will do is see that the state of the workqueue is enabled, and return 0 instead of attempting to issue a command to enable the workqueue. So once a workqueue is found that needs to be re-enabled, set the state to disabled prior to calling idxd_enable_wq(). This would accurately reflect the state if the enable fails as well. Cc: Fenghua Yu Cc: Dave Jiang Cc: Vinod Koul Cc: dmaengine@vger.kernel.org Fixes: bfe1d56091c1 ("dmaengine: idxd: Init and probe for Intel data accelerators") Signed-off-by: Jerry Snitselaar --- drivers/dma/idxd/irq.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/dma/idxd/irq.c b/drivers/dma/idxd/irq.c index 743ead5ebc57..723eeb5328d6 100644 --- a/drivers/dma/idxd/irq.c +++ b/drivers/dma/idxd/irq.c @@ -52,6 +52,7 @@ static void idxd_device_reinit(struct work_struct *work) struct idxd_wq *wq = idxd->wqs[i]; if (wq->state == IDXD_WQ_ENABLED) { + wq->state = IDXD_WQ_DISABLED; rc = idxd_wq_enable(wq); if (rc < 0) { dev_warn(dev, "Unable to re-enable wq %s\n", -- 2.37.2