Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3655616pxb; Mon, 24 Jan 2022 14:34:16 -0800 (PST) X-Google-Smtp-Source: ABdhPJy7d4ZYQikFtOSCXzGvHA2zw/jTe8TBquLukpZj/HsTPqS6rEgx6wGdNAXm2niV7NQ3Sfz6 X-Received: by 2002:a05:6a00:1a41:b0:4c1:e6e9:3bf4 with SMTP id h1-20020a056a001a4100b004c1e6e93bf4mr15956996pfv.25.1643063656145; Mon, 24 Jan 2022 14:34:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643063656; cv=none; d=google.com; s=arc-20160816; b=aGQw7Lqy+dh2nRsPvVS+kQIACrcB6YkTPO3GsX63zXMfDyNl0r4rKzjipdr/sbWrqs dELKnU2Lk2xpRR0xxAXkd4V0nJ60gmjypPazLVsM115uMaOKbEikY+DwE6EHfqwuWDea bWqB9UhqLVCb0vVALglhDiVPVMcTNN0xJfATp8S5WbzNVzOo/fxE+ReWV+k/5iO3QdYQ sqhJ474jMPAGqaHVeutSU9fQTZFTOxXxgGQZ1qultoRMrJR/xkVGahPsX6/kJ/0lD9fe KQjrTKvY7NJuk1lwLYpYceuKKYZ8aCB9/+iuYD/p3BorZazbWeTRVe1/GzdbBkYPj6+Z 0abA== 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=KqBJFzGWns7i1Crgr3FjD7dGDX77PSJpu6WMBbbeXPs=; b=R58BG4wxN8SDzw45LtPJ4eN5xl8ZS5VRHZBNoUYVWDXdsonhYKqj1D+jfAaLSpBFbt TT9popG8k+JEjc6Py6LnzP+vWa65HiTS0POiwMopJOssJDigecaE4NwWC8eNkeSewQEa O8ZcwIqHt9g4gTEFx3E3iZ7oC2Xt1RTU4CSr+Vj91xmF6IVNF9ypsoYkokzriPdl4E7t ioVB5nZqY7uFff+oKqPTEQ6/wYEbuW3BycLSduoxiccN77TB/9oXEHATotpnwXLUush4 SmSuM5dd//Z2B1CKsuN159wQRHTCcvPnsrkOYyLXz7Q4eqQonXIHbTWMagf3vz10u3Sa dUWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="icgJoUL/"; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z1si700948plk.513.2022.01.24.14.34.04; Mon, 24 Jan 2022 14:34:16 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b="icgJoUL/"; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1382428AbiAXWc6 (ORCPT + 99 others); Mon, 24 Jan 2022 17:32:58 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:58036 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1444637AbiAXVjb (ORCPT ); Mon, 24 Jan 2022 16:39:31 -0500 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 64EAD612E5; Mon, 24 Jan 2022 21:39:27 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D26AC340E4; Mon, 24 Jan 2022 21:39:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643060366; bh=MwVDU5KHXsZMAwuTBPhjmF0Tyu+ExRo7B82mYWrX2lQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=icgJoUL/oGhuK3ZuQgraHVw/m+NO10p/fitA4OFn5NH3J/9IKJT5t4AtBTSRscZDb sZj62ylWqGyl8DiP2ssluTBrM534u8s18p1L+1IMA1lyPpdNAXCVVXUnbBsZqwzbpm nmpinDyeKaDd/iZdCQyEsnfy/+ORNYAY0yOLyXYs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lucas Van , Dave Jiang , Vinod Koul Subject: [PATCH 5.16 0924/1039] dmaengine: idxd: fix wq settings post wq disable Date: Mon, 24 Jan 2022 19:45:13 +0100 Message-Id: <20220124184156.355071904@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dave Jiang commit 0f225705cf6536826318180831e18a74595efc8d upstream. By the spec, wq size and group association is not changeable unless device is disabled. Exclude clearing the shadow copy on wq disable/reset. This allows wq type to be changed after disable to be re-enabled. Move the size and group association to its own cleanup and only call it during device disable. Fixes: 0dcfe41e9a4c ("dmanegine: idxd: cleanup all device related bits after disabling device") Reported-by: Lucas Van Tested-by: Lucas Van Signed-off-by: Dave Jiang Link: https://lore.kernel.org/r/163951291732.2987775.13576571320501115257.stgit@djiang5-desk3.ch.intel.com Signed-off-by: Vinod Koul Signed-off-by: Greg Kroah-Hartman --- drivers/dma/idxd/device.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) --- a/drivers/dma/idxd/device.c +++ b/drivers/dma/idxd/device.c @@ -382,8 +382,6 @@ static void idxd_wq_disable_cleanup(stru lockdep_assert_held(&wq->wq_lock); memset(wq->wqcfg, 0, idxd->wqcfg_size); wq->type = IDXD_WQT_NONE; - wq->size = 0; - wq->group = NULL; wq->threshold = 0; wq->priority = 0; wq->ats_dis = 0; @@ -392,6 +390,15 @@ static void idxd_wq_disable_cleanup(stru memset(wq->name, 0, WQ_NAME_SIZE); } +static void idxd_wq_device_reset_cleanup(struct idxd_wq *wq) +{ + lockdep_assert_held(&wq->wq_lock); + + idxd_wq_disable_cleanup(wq); + wq->size = 0; + wq->group = NULL; +} + static void idxd_wq_ref_release(struct percpu_ref *ref) { struct idxd_wq *wq = container_of(ref, struct idxd_wq, wq_active); @@ -699,6 +706,7 @@ static void idxd_device_wqs_clear_state( if (wq->state == IDXD_WQ_ENABLED) { idxd_wq_disable_cleanup(wq); + idxd_wq_device_reset_cleanup(wq); wq->state = IDXD_WQ_DISABLED; } }