Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp7727178imu; Fri, 28 Dec 2018 03:55:35 -0800 (PST) X-Google-Smtp-Source: ALg8bN6UWyFYj8bR6hKdIKuLLolSuR4tdH0+jOBRZx3wC0jgqnfHluYbfSHiSDg1P0pQS1mbaCvR X-Received: by 2002:a17:902:47aa:: with SMTP id r39mr26989495pld.219.1545998135616; Fri, 28 Dec 2018 03:55:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545998135; cv=none; d=google.com; s=arc-20160816; b=jI0JEDcFycSrFDuwsBmdruALZ72B4pXEuWtelieT4ybg46RIp+OC97nlFhzw+J2fbz pH0gv7aChW8rL3ZO/DJ9N0N0cWjt/daLe2PGOcv+kJJoTSVnY+Wrde4wE8mI+KzScIcG w3kdVOJWvhDZzwLxw/E6nRgCPoohf6Hz8lPJ7kjQaMdgknF2snPP5IOAua1IN03iE5b8 QK0NltxuHQ2mCthx5ORtYotALFWgcPZW6liNaYIpPH4pYG//KfZQkvnUdzmzkVW0V3ee 4eYaWARcsl9HsqxkbQJuqM77VtLzE14uFYsLToyHAd+9U7gAFMNogJHokqWD0j0IFF9u F0QQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=C8Nto6nXxU5WwVKzUWnQ8V5rARI8RREI7vnlZ1Cl/iM=; b=YZiqpgqI2jAYpAoM3ANWfUj9zk/cif0L4hiktvnYlZiZvas++cik4qhkKcQ4Pa6UKJ XXoaHBkNEA0j25bjAcw0xgyxS6MQq9LZCdbApRms7oNOoUl00lniYOPeRVZeQa9X9DVx AmZZ+pEJHvnfUx5gVC+murWllnEJRWeoE2rvA88wzVLW/K3JR5iOhB6MXWCKiPAERkgx eZUDrdr4+NLJPnhx7BbiDp5YxZZloy/PpEKJ+QaXrsLdnaLBHhoFnUEKwoumuU3FTfFK 8luFwtTejEOHF0lbEpXRTlabDZBPfxdzoh1z1swGUbP5ifbVqu8MH0NAgtB3vaV3LLqj qCPQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=MH5a7QYe; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e1si39429049pln.55.2018.12.28.03.55.20; Fri, 28 Dec 2018 03:55:35 -0800 (PST) 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=@linux-foundation.org header.s=google header.b=MH5a7QYe; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731064AbeL1BhI (ORCPT + 99 others); Thu, 27 Dec 2018 20:37:08 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:34551 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727152AbeL1BhI (ORCPT ); Thu, 27 Dec 2018 20:37:08 -0500 Received: by mail-lj1-f193.google.com with SMTP id u89-v6so17593240lje.1 for ; Thu, 27 Dec 2018 17:37:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=C8Nto6nXxU5WwVKzUWnQ8V5rARI8RREI7vnlZ1Cl/iM=; b=MH5a7QYea2NYc1XOCn8Pt9nuPNC2TSpp8ig+/m2924aifBJIlRKwdkJ0CPestnVzRJ g0p4gFs0+yrbjuTxq4Jsr0Iw35G4AL7wxNJSnfvDGEEczPkfy0ZAcBeiYHzysNTG32IR ijZeu5M+Ei6ovqMfIOM5XmNZunaTv/U7t5iXI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=C8Nto6nXxU5WwVKzUWnQ8V5rARI8RREI7vnlZ1Cl/iM=; b=ClMR+i7CPIqEoU2lWbBHSvKI1Q+qe8bSODqOpYo3oJApelunuVJSGsactqQOlV7A9f cDudbRPS1A5qkut9xRZSYz7Pzw3N8Xgr1M/GMy54vIqxLaYhP2ExcjZsvW8hxaY+bzJF g0CHeA4RjbYcW0xx+iLssWJbrKGM2nBQM5/b8nj7B9zJMwLYdAvEW9n+OpbRUHDhy8z0 WiprfNatxhXkt0awKJWvAKMbnkyPrhWg++gHWnDZs6d9hPg2jgzkhXKjFDQr/xODAtlN KCzoLqUj4QkF/3elFyy+eAJVdYecvo38drgKT2pHw3NtChqQzYnEzDwSOFfFnD/OcVJ5 uvXQ== X-Gm-Message-State: AJcUukeXZefabwwmisG5IVup8excrCcdYLIgRYOk1UptEFo9meDpuGfS HvCIUsye/Z6KcCm4YYWbkoOlAOyUJhk= X-Received: by 2002:a2e:3a04:: with SMTP id h4-v6mr14531493lja.81.1545961025588; Thu, 27 Dec 2018 17:37:05 -0800 (PST) Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com. [209.85.208.176]) by smtp.gmail.com with ESMTPSA id l3-v6sm8339744ljg.21.2018.12.27.17.37.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Dec 2018 17:37:04 -0800 (PST) Received: by mail-lj1-f176.google.com with SMTP id n18-v6so17567995lji.7 for ; Thu, 27 Dec 2018 17:37:03 -0800 (PST) X-Received: by 2002:a2e:310a:: with SMTP id x10-v6mr16168446ljx.6.1545961023303; Thu, 27 Dec 2018 17:37:03 -0800 (PST) MIME-Version: 1.0 References: <1545879866-27809-1-git-send-email-xiexiuqi@huawei.com> <20181227102107.GA21156@linaro.org> <20181228011524.GF2509588@devbig004.ftw2.facebook.com> In-Reply-To: <20181228011524.GF2509588@devbig004.ftw2.facebook.com> From: Linus Torvalds Date: Thu, 27 Dec 2018 17:36:47 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] sched: fix infinity loop in update_blocked_averages To: Tejun Heo Cc: Vincent Guittot , Sargun Dhillon , Xie XiuQi , Ingo Molnar , Peter Zijlstra , xiezhipeng1@huawei.com, huawei.libin@huawei.com, linux-kernel , Dmitry Adamushko , Rik van Riel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Dec 27, 2018 at 5:15 PM Tejun Heo wrote: > > I'm pretty sure enqueue_entity() *has* to be called with rq lock. > unthrottle_cfs_rq() is called from tg_set_cfs_bandwidth(), > distribute_cfs_runtime() and unthrottle_offline_cfs_rqs. The first > two grabs the rq_lock just around the calls and the last one has a > lockdep assert on the rq_lock. What am I missing? No, I think you're right, and I just didn't follow things deep enough, didn't see any rq locking in the loop in unthrottle_offline_cfs_rqs(), and didn't realize that the rq is locked by the caller. > > But that still makes me go "how come is this only noticed 18 months > > after the fact"? > > Unless I'm totally confused, which is definitely possible, I don't > think there's a race condition and the only bug is the > tmp_alone_branch pointer getting dangled, which maybe doesn't happen > all that much? Ahh. That would explain the list corruption. The next list_add_leaf_cfs_rq() could try to add to a removed entry. How would you reset it? Do something like rq->tmp_alone_branch = &rq->leaf_cfs_rq_list; for every removal, or make it conditional on it matching the removed entry? Linus