Received: by 10.192.165.148 with SMTP id m20csp3238819imm; Mon, 7 May 2018 08:55:01 -0700 (PDT) X-Google-Smtp-Source: AB8JxZr6U4uWlNr5j39NxBBymBGn5yJx6WAUyALvWE/lvMVJUM5uuSGXROQw23Z3nfubXsYWKWIY X-Received: by 2002:a24:b25c:: with SMTP id h28-v6mr1812747iti.23.1525708501012; Mon, 07 May 2018 08:55:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525708500; cv=none; d=google.com; s=arc-20160816; b=LAURdU0ksj7Dr2VwJbayGkosU4M+uO0dLiyIklM36CuWEzac2qMysiNggNI5j14yKs UWk13t/oKZQSp79S9dpggk82ZraFcL+knw1I1pQQYo/1a9gen4/ZeJT8e9VcpCGcDgsg FKNw4juxuZe5Brk+qgwv4iJAg8BOweeYoTJA6E7rDIu4/Mjl+9WmuSLXoILX7kWpLcs2 IKnVDiyGJWwi+HFrEtq5eXYXmXgLloZoFW3Y5Sa+YUIlGsgwAudtS0TgQU9zQd9lDqSI Kqru5M1vIIvWqACSzlRzKKrWCeH4UsbDBH/L/qQDVW9Ra5tGFQypVY43J0FpGqV1GlQ5 Ltwg== 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=RIWByFSkhRTNh2mfZgd+oABBmGamAUaBpVbUN4a6n5A=; b=GJLDpO+yS4TirvSDPmbGZLtVW77upSoTgFUwRrQxMuxWt+SPllscpWte9xLGUuNfvv k9Ete0qNxhdpUU2XII7NVpoygU8Ly9spYgPo/HrHiLogNgJv6VyUQyqWo8KoVru1Ty1c fa2PM0scgEZMMSCbPf/NPS8CCy7wSJQSqj8Q94hCcNi8D1PZah8ESFwgO4OkRHebzZKs 8iBloZBiyeRa1acF1O9aiHa9tDMX1A3Rs6cIV9LQucTScjTORurTbmlaev67WE0leHvi 5ixjLPFdaWtiom9Ej7numRc6mO5r7taRajRK3fVhVzKxuh1wAVQBRN4r5Y/M5/DLwoO0 8FLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2017-10-26 header.b=nwVeiQQv; 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 c188-v6si7589687ite.22.2018.05.07.08.54.47; Mon, 07 May 2018 08:55:00 -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=nwVeiQQv; 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 S1752754AbeEGPyT (ORCPT + 99 others); Mon, 7 May 2018 11:54:19 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:37604 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751953AbeEGPyP (ORCPT ); Mon, 7 May 2018 11:54:15 -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 w47FpMi1163541; Mon, 7 May 2018 15:54:10 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=RIWByFSkhRTNh2mfZgd+oABBmGamAUaBpVbUN4a6n5A=; b=nwVeiQQv9WIlR+cS0CXTlGDSfGVHTwDDTDjs+pLwmG0z3ofQuZ1MXf0FdLASI1tr5ma+ C7uvhnr2V1VfPSYrwOBZLrPXhCi+W2xhrgBM164m42s+MautnkQ7fICcbRuNz0E0BtZ+ jtY1Q7dOUpucD3+jNtJmt4TbubnSdM4WIITKC5GLMtgk8a7t6lnIg0siHZwnJIqc5dmw rdDM7tlgi3mNlJG7DIuofbi6Z8v32j8El3o/BlzZQyvLHcWPzSIE1eH8dTVAnCQEeuAi +g3inlQ+W2eWwKVxB5qOKZJemsXGo/mrZYAN5f4YgOiLBYYpc0TE7DSI+KKt+UXYQ2nK 9g== Received: from aserv0022.oracle.com (aserv0022.oracle.com [141.146.126.234]) by userp2130.oracle.com with ESMTP id 2hs426cved-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 07 May 2018 15:54:09 +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 w47Fs8ho018323 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 7 May 2018 15:54:08 GMT Received: from abhmp0010.oracle.com (abhmp0010.oracle.com [141.146.116.16]) by userv0122.oracle.com (8.14.4/8.14.4) with ESMTP id w47Fs7Sn024883; Mon, 7 May 2018 15:54:07 GMT Received: from xakep.us.oracle.com (/10.39.250.224) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 07 May 2018 08:54:06 -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 v3 0/1] multi-threading device shutdown Date: Mon, 7 May 2018 11:54:01 -0400 Message-Id: <20180507155402.10086-1-pasha.tatashin@oracle.com> X-Mailer: git-send-email 2.17.0 X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8886 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=971 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1805070161 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Changelog 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 device_shutdown() s 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 | 275 ++++++++++++++++++++++++++++++++++++-------- 1 file changed, 225 insertions(+), 50 deletions(-) -- 2.17.0