Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1405395imm; Tue, 15 May 2018 19:42:14 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrp6GDy88ockkZkN79NTnc0BccDiSgeJ7fByp3oSfDuBB3j9jpME32jam0FfVD/N7dip+C3 X-Received: by 2002:a62:230b:: with SMTP id j11-v6mr17684648pfj.177.1526438534115; Tue, 15 May 2018 19:42:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526438534; cv=none; d=google.com; s=arc-20160816; b=qC+Wqte8lt4e+dZH85S6JDx+LbHChmd4mP+hezubc1+4pY7JgbTFaCwS7/oHXP0A7A +Kdu3N++G/Rx2d+3We/NyN53Hh2VsR9KkS/0UH5nzt+5EmwQa4DzdwYV9g7rAoTfHa4d kPjjB/o89rTQSxOgj3Sujz/8lKGX4/qJZiRjQBWrj5ezx1AmSug6W9rzS0M90mL5/hZ4 ToLhvOA1jk2RXUw+b68wnPgImgHaNz0eL5hPNr4oxTdYqnhljzZkTwlrpsM7tiYiY9c+ +QCcYyRAuldUKD3v/kbBI6QY8qbc4BHB4qEwGjXig9x49QmuGedOBKiUgHPC2glKug/k xXzQ== 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=XSjgfFK0FvKV48A3X//qcihVL0Flac88FHPQJDe0zZo=; b=mcewBVOUKwN+rypOeXvS1FzBwSBe2cJmckjKiHCyHUQ6CChKwfe20CpOoUgDM/iVHb XeanBJz1M7lCV1EleENAisNjWCIjVEGnLiuy6Wab980KfcHNEej4U96ais+WJB5+thpR 5FGEyDDGQbyU5MDA2k/9hmhAlHNe+iHfEXJXXEH/+NHsrTD2KEzsaI1h6uzpqxCI8x7r U/IXZnH/T/MexNnKWl5SSrVoDfjTYPQGBZcdh6Q4BgL0FJreCKSo0n/7lwDZDDQbSJ7q Rm1wADA+ZvwHYL5tJv5WpXGDAlpwfg/6GGjSh605ezYpmMJ0Us8HBvVLMeP6OUeyMr0A 3TsQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=eHXZtCZ2; 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 x2-v6si1236433pgp.298.2018.05.15.19.42.00; Tue, 15 May 2018 19:42:14 -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=eHXZtCZ2; 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 S1752447AbeEPClP (ORCPT + 99 others); Tue, 15 May 2018 22:41:15 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:38112 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751634AbeEPCkX (ORCPT ); Tue, 15 May 2018 22:40:23 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w4G2afo1102188; Wed, 16 May 2018 02:40:15 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=XSjgfFK0FvKV48A3X//qcihVL0Flac88FHPQJDe0zZo=; b=eHXZtCZ29yYv14rhXEt7bWUglyZWEUW3LiCvcVqmiuBuJM9PfEXRueFE4HfkDifdnoct ej8qoVP/B5+1aw0yvKPTbpf6/Es5HHjGPIq4XGkSOnsWMv+CPftSWCpJi8znQWiU3G2F BXB/YDIOa0NsjPt5vHs6431K/vr/DwYZH0tjuGz6ihXFlEojB7fuTQv26guZRaQaqA+3 Ncyot7L78Oi05s0JUFZ75w9EYjuYq0FvQNwiFVleaFfoS2fmJGS9hl6s3XmS59YC3Ika jqMa7N+LZIgkcBf7oTFD0TebckhHfIpNo+HZ1AH7zzLAE/bv3ne7FZ2nlql1I8q3tiFj +A== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2hx29wat4r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 May 2018 02:40:15 +0000 Received: from userv0122.oracle.com (userv0122.oracle.com [156.151.31.75]) by aserv0022.oracle.com (8.14.4/8.14.4) with ESMTP id w4G2eEuP008096 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 16 May 2018 02:40:14 GMT Received: from abhmp0003.oracle.com (abhmp0003.oracle.com [141.146.116.9]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w4G2eDdE000425; Wed, 16 May 2018 02:40:13 GMT Received: from localhost.localdomain (/73.69.118.222) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 15 May 2018 19:40:12 -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, andy.shevchenko@gmail.com Subject: [PATCH v5 0/3] multi-threading device shutdown Date: Tue, 15 May 2018 22:40:01 -0400 Message-Id: <20180516024004.28977-1-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.17.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8894 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-1805160023 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Changelog v4 - v5 - Addressed comments from Andy Shevchenko and Greg Kroah-Hartman - Split the patch into a series of 3 patches in order to provide a better bisecting, and facilitate with reviewing. 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 (3): drivers core: refactor device_shutdown drivers core: prepare device_shutdown for multi-threading drivers core: multi-threading device shutdown drivers/base/core.c | 290 +++++++++++++++++++++++++++++++++++++------- 1 file changed, 243 insertions(+), 47 deletions(-) -- 2.17.0