Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp4769871imm; Mon, 14 May 2018 12:44:11 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpDx/CrsgnbdrfsxLRA+PaPeUE5/KEmoj+BjFXn8v5y9eFmCXeVpbdaB25KKE9xA1ZPgRXo X-Received: by 2002:a62:bd2:: with SMTP id 79-v6mr11784242pfl.4.1526327051705; Mon, 14 May 2018 12:44:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526327051; cv=none; d=google.com; s=arc-20160816; b=cmUVXYuu7NbYVwg1FHgtqMU5cwJSdULvXNHiJL7sE53voXLlFtov6p3/86SGhtvp8C euJZ7pJHh4d9fXOXuzZEyXW+ZMY4hlzNiI1LXbiPrSvyaW6+TBu71YYb1LhMJXIqJXFT 7O8xEd5DHoXR2oQtQdu2pV6jIl+g27PdP6UzkZKE7Q3GdQdVdgMi6YqCuEo/Z6mIjfqf MJ9mTeQx2lKd4/W2ash3DP5q9bdoDjm9RjpF3q06PHVakGCh5+rUvR0Jxc8NAhZhHi71 kTu3wX8PmtROIoGS1NlhkIzE1RU/M/9h31juKKpxIiPPQm1wt+EyOjOHMkSq9Gq8ygxM 8Bbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:to:from :dkim-signature:arc-authentication-results; bh=R/8xJXLNwx7jI7BMaS4HzN6TbAXrUDQGY3w2mVhvCOw=; b=G3erly/8BOH8rx06kiGq+QSRzA1dnZTfaI2VHJDUvJ8Lxk2Q68YMor8XFsIDx+g3QF HnBCp9RwrI5oXDz/iIzRb9mw4E/Lp2azSTCqAcr26Y48BmfkXebGcYcALzpGtyY8w0Vh xyRIczsBRftGU8LiIIe96kFeOGY2UVXfLYsNBHw2RdihITjqKKmKQQNEEoVFgUnQ9E7j HdktD3eAT2PoUW0Naocr32/rGkeSDCanBm8B7v2xfAocVjH4AnATfQbjzZuxp9B72tkp CHnttcAlSqPCOLGtG52X6CjP/PSEgb7x+HwEUIg8hcGEb0uJvjdgK/ROZkIyEOBmpl6F fZzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=LR0CoI1X; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t23-v6si6733872pgv.360.2018.05.14.12.43.57; Mon, 14 May 2018 12:44:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=LR0CoI1X; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752063AbeENTnK (ORCPT + 99 others); Mon, 14 May 2018 15:43:10 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:48246 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750750AbeENTnI (ORCPT ); Mon, 14 May 2018 15:43:08 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w4EJfW3t086107; Mon, 14 May 2018 19:43:02 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : subject : date : message-id; s=corp-2017-10-26; bh=R/8xJXLNwx7jI7BMaS4HzN6TbAXrUDQGY3w2mVhvCOw=; b=LR0CoI1X9+oTaozKGPu2Xwyo4sAsFe5E+OlHEfNTRodSKZI9aZqui745RRNNRCaedEzN mPnW25uXnlRzyASFoYb/MZtrKkgRo3g5AsNP6OtVZUXrdeE8f1AjaFT9Gb1v0MhG1NuN 0MjDafLk+O4Cu2ByN0QgkAV7Ific2lEQiLQsoq83A/cI3HD+cyfqSFJLPhJQ1VxMuNH5 aFLKgP2EAXwEe4ndRT7aG2ED1Cga62MGu8+gQXRbsxhtT+99THzw0wXmDCHc9zEM3oSU n9UG4mUqsi4kMeJXnJ5auv+3WODb93wO6GG2X/Lg3C6cbdEIW+uKntG1RcII9C8e9Dpy IQ== Received: from userv0022.oracle.com (userv0022.oracle.com [156.151.31.74]) by userp2120.oracle.com with ESMTP id 2hx29vwhmc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 May 2018 19:43:02 +0000 Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by userv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w4EJh1Ef027837 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 14 May 2018 19:43:01 GMT Received: from abhmp0019.oracle.com (abhmp0019.oracle.com [141.146.116.25]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w4EJh0cp003024; Mon, 14 May 2018 19:43:00 GMT Received: from xakep.us.oracle.com (/10.39.255.157) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 14 May 2018 12:43:00 -0700 From: Pavel Tatashin To: pasha.tatashin@oracle.com, steven.sistare@oracle.com, daniel.m.jordan@oracle.com, linux-kernel@vger.kernel.org, jeffrey.t.kirsher@intel.com, intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org, gregkh@linuxfoundation.org, alexander.duyck@gmail.com, tobin@apporbit.com Subject: [PATCH v4 0/1] multi-threading device shutdown Date: Mon, 14 May 2018 15:42:53 -0400 Message-Id: <20180514194254.14748-1-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.17.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8893 signatures=668698 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805140198 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Changelog v3 - v4 - Added device_shutdown_serial kernel parameter to disable multi-threading as suggested by Greg Kroah-Hartman v2 - v3 - Fixed warning from kbuild test. - Moved device_lock/device_unlock inside device_shutdown_tree(). v1 - v2 - It turns out we cannot lock more than MAX_LOCK_DEPTH by a single thread. (By default this value is 48), and is used to detect deadlocks. So, I re-wrote the code to only lock one devices per thread instead of pre-locking all devices by the main thread. - Addressed comments from Tobin C. Harding. - As suggested by Alexander Duyck removed ixgbe changes. It can be done as a separate work scaling RTNL mutex. Do a faster shutdown by calling dev->*->shutdown(dev) in parallel. device_shutdown() calls these functions for every single device but only using one thread. Since, nothing else is running on the machine by the time device_shutdown() is called, there is no reason not to utilize all the available CPU resources. Pavel Tatashin (1): drivers core: multi-threading device shutdown drivers/base/core.c | 292 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 242 insertions(+), 50 deletions(-) -- 2.17.0