Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3041031pxa; Tue, 18 Aug 2020 05:12:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzpqiQxJ35I2nZmfTQz32KzlQ6b/TeIUKuqQl7vGrCP4LZEI9gK0Bbmx+UrScwZOs5dHlPQ X-Received: by 2002:a17:906:9356:: with SMTP id p22mr19478192ejw.119.1597752775760; Tue, 18 Aug 2020 05:12:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597752775; cv=none; d=google.com; s=arc-20160816; b=qNfsLl9Q6GXuuNpu4osJ1QQvrojklwlY+PtULpyHAWwPxj87Rh11vg4gXBoeqfJARX 8OLG9nVdQIML7y12zZxkheaXKSCdPdGtSMm0pLHry4yODOi1b5CKAhC6l82FJcKVTObo 4/l7xAcgj00WASVfa9aGBA/aq22mDocCgABihhP+Msf7huKQhwOYdhH/ufwTt/XDdwLA quvUtVH3J0ZDvEpA/MhYyq/rKRlnil+0CcuhJdWsAnq+VeaRdi3KyElyH59/0slHoB0e zV01XNq2jm3zE6EZQ32ieuakDo4h3/l5+KD+tFrTLm+uknX0BJTVfUHkvYl3l3T3y582 avxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :ironport-sdr:ironport-sdr; bh=tUTB4PH5ZaOjV1oOIlfiY4OdHv98/isG06m8AoXvsFA=; b=MIl5nsYH4Xr4YoIS9QUIO+BXzAzdX+nQgSAa+milRZ8f6x76meag7SsLIKqu6+H02y w9FI+uLk67qe+QwgF949+CLnPyttaNnhSKegqDnV4532xLBGkH799ycDP3s+zSlh83Gp sYxWxkCddnjpqlFQs3CSArdRnm7nhOvqUYrw/srqE6oXhi4JHTDnFxFWeGUewq/tquCx XrZ5Snne3em1KF/HYHSPtczH2zg7Nxq5/vhN4614lC/xDSbvlhgMEPqvlYa9M7QAszmv gehVeEi9cEUuaPLQgdhOrTinmw0/NqVzAGF+3fXKFKgcxDRz5jXz+8tpM7AkYQPypxxX dAcw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i12si12450028ejy.492.2020.08.18.05.12.31; Tue, 18 Aug 2020 05:12:55 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726853AbgHRMKb (ORCPT + 99 others); Tue, 18 Aug 2020 08:10:31 -0400 Received: from mga07.intel.com ([134.134.136.100]:58731 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726777AbgHRMKR (ORCPT ); Tue, 18 Aug 2020 08:10:17 -0400 IronPort-SDR: ZY/UoZQiqBHmbkLnIATtIk0fnJ4l8iqI8pZBnalYoM+V4EjKij84+H28YUvQhVnMVKLCCFsASj NIsY/yUdgV3w== X-IronPort-AV: E=McAfee;i="6000,8403,9716"; a="219200396" X-IronPort-AV: E=Sophos;i="5.76,327,1592895600"; d="scan'208";a="219200396" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2020 05:10:17 -0700 IronPort-SDR: NiRLWa7pniPOnGQ5riFMZvIC2gtrvvpkTW3KxnoaJbaYB1I2XlvRnEIE/8yI43pOLcYnVOS2GQ oHOj9nYbPsng== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,327,1592895600"; d="scan'208";a="326713029" Received: from twinkler-lnx.jer.intel.com ([10.12.91.138]) by orsmga008.jf.intel.com with ESMTP; 18 Aug 2020 05:10:13 -0700 From: Tomas Winkler To: Greg Kroah-Hartman Cc: Alexander Usyskin , linux-kernel@vger.kernel.org, Tomas Winkler Subject: [char-misc-next 08/13] mei: handle tx queue flushing for vtag connections Date: Tue, 18 Aug 2020 14:51:42 +0300 Message-Id: <20200818115147.2567012-9-tomas.winkler@intel.com> X-Mailer: git-send-email 2.25.4 In-Reply-To: <20200818115147.2567012-1-tomas.winkler@intel.com> References: <20200818115147.2567012-1-tomas.winkler@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alexander Usyskin Since multiple file pointers (fp) can be associated with a single host client, upon close() only objects associated with the fp has to flushed from the tx queues. The control queues should be flushed only when all the connections are closed and the client is disconnected. Signed-off-by: Alexander Usyskin Signed-off-by: Tomas Winkler --- drivers/misc/mei/client.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/misc/mei/client.c b/drivers/misc/mei/client.c index 3904fce18261..d5c3f7d54634 100644 --- a/drivers/misc/mei/client.c +++ b/drivers/misc/mei/client.c @@ -429,14 +429,16 @@ static void mei_io_list_flush_cl(struct list_head *head, * * @head: An instance of our list structure * @cl: host client + * @fp: file pointer (matching cb file object), may be NULL */ static void mei_io_tx_list_free_cl(struct list_head *head, - const struct mei_cl *cl) + const struct mei_cl *cl, + const struct file *fp) { struct mei_cl_cb *cb, *next; list_for_each_entry_safe(cb, next, head, list) { - if (cl == cb->cl) + if (cl == cb->cl && (!fp || fp == cb->fp)) mei_tx_cb_dequeue(cb); } } @@ -574,13 +576,14 @@ int mei_cl_flush_queues(struct mei_cl *cl, const struct file *fp) dev = cl->dev; cl_dbg(dev, cl, "remove list entry belonging to cl\n"); - mei_io_tx_list_free_cl(&cl->dev->write_list, cl); - mei_io_tx_list_free_cl(&cl->dev->write_waiting_list, cl); - mei_io_list_flush_cl(&cl->dev->ctrl_wr_list, cl); - mei_io_list_flush_cl(&cl->dev->ctrl_rd_list, cl); - /* free pending cb only in final flush */ - if (!fp) + mei_io_tx_list_free_cl(&cl->dev->write_list, cl, fp); + mei_io_tx_list_free_cl(&cl->dev->write_waiting_list, cl, fp); + /* free pending and control cb only in final flush */ + if (!fp) { + mei_io_list_flush_cl(&cl->dev->ctrl_wr_list, cl); + mei_io_list_flush_cl(&cl->dev->ctrl_rd_list, cl); mei_cl_free_pending(cl); + } spin_lock(&cl->rd_completed_lock); mei_io_list_free_fp(&cl->rd_completed, fp); spin_unlock(&cl->rd_completed_lock); @@ -798,8 +801,8 @@ static void mei_cl_set_disconnected(struct mei_cl *cl) return; cl->state = MEI_FILE_DISCONNECTED; - mei_io_tx_list_free_cl(&dev->write_list, cl); - mei_io_tx_list_free_cl(&dev->write_waiting_list, cl); + mei_io_tx_list_free_cl(&dev->write_list, cl, NULL); + mei_io_tx_list_free_cl(&dev->write_waiting_list, cl, NULL); mei_io_list_flush_cl(&dev->ctrl_rd_list, cl); mei_io_list_flush_cl(&dev->ctrl_wr_list, cl); mei_cl_wake_all(cl); -- 2.25.4