Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2272564imc; Tue, 12 Mar 2019 10:19:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqzfYm5P7zMAoPtRmQkZx90nZidSpYrDB1YjuNTLSa4VkgfpP25/HHwns56RKuJh4vclpDjt X-Received: by 2002:a17:902:bd96:: with SMTP id q22mr41081969pls.7.1552411196683; Tue, 12 Mar 2019 10:19:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552411196; cv=none; d=google.com; s=arc-20160816; b=hRMTzLovBMWaXDWHRHz8hpCnts1wvXtzOfUlWn0Pu0LYvLs8osuaxFvcKj20SctZf3 SvrGJMFSxh71ORq/7ICkA8evLhzsuUT8MPAou0Dnc1n+eD+iEqntByqKu6gTa+7T7Y05 bWF5VCmPBp71knfm+X7nzSetLac2eC3iRU/1Yu2bPKWajqPg7PcVOyrbde2Ww6wikkHv 5nef2kwZiV/5s7ssOdsFukLD3uI8cGwH5BW3kj5Vcjnp76KVrfmtnWxLUWCiUBhWw7/V eAVblxOB2yJ5t1lymyjIQn9h3QVbbPaGuIAZY9pFU9uiiFEJCDbIIWVg2aCWmIsHFTgE wTbQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=XNPCeYbyEvjH0myCmF1jI6MpjapFNh6k2h+KbYIZjDo=; b=wigdrw15lcJSiBhIp2j9Tf0PFfubfsS2IS8usXq1QqfSYmA1a3TPe2bYwxthws8U4J 64a7gw7KzXxM4qJnGEzhVRulI8QSjjIIheUjpeoGxhvgk5IuIMLrLkZf/RxrgUDJFT5e KhuZzjTttKlDaaXipxDAP7IO1wtIgqKZL9Udc6vavxi29vXr6Joyn/nWtYr/jfluba2J hLe9xT+E6gkvIXJYBzFJBWzEx6XQ3yaPswh87BkdlEGzp44F97FGqrC9ibyAf4fPzRfH Jo4o48W1Be2rpCC0hyQxm+Jzl2mX+QekKhv6HvdZAe9MzORai4/beZ77UhLiUIldOhaO 4wFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xypoRC19; 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 q4si7542338pgv.338.2019.03.12.10.19.41; Tue, 12 Mar 2019 10:19:56 -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=@kernel.org header.s=default header.b=xypoRC19; 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 S1730074AbfCLRSX (ORCPT + 99 others); Tue, 12 Mar 2019 13:18:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:34290 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729770AbfCLRRu (ORCPT ); Tue, 12 Mar 2019 13:17:50 -0400 Received: from localhost (unknown [104.133.8.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B94FC2183F; Tue, 12 Mar 2019 17:17:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1552411069; bh=EHodQHAv/IQtKTEYUT+Ji9MDxercDNCJe8JRWtSr36M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xypoRC199sn9HOaaHQ4wxYLJV/uweh3+J15etd5g0Rf6OXlbUVkCUMZvZUQN6exAS jitkclkUkOqEU5dNOwg+qoukK8MFB2U2+OiwzkDRWOrfmtW5uHjRspfPGjQrnp9aVT W+yxQlvWt0qCEbYSc9RN8YDk3lX3yr++qM30pA4I= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Max Filippov , Sasha Levin Subject: [PATCH 4.9 42/96] xtensa: SMP: fix ccount_timer_shutdown Date: Tue, 12 Mar 2019 10:10:00 -0700 Message-Id: <20190312171037.701374612@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190312171034.530434962@linuxfoundation.org> References: <20190312171034.530434962@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 4fe8713b873fc881284722ce4ac47995de7cf62c ] ccount_timer_shutdown is called from the atomic context in the secondary_start_kernel, resulting in the following BUG: BUG: sleeping function called from invalid context in_atomic(): 1, irqs_disabled(): 1, pid: 0, name: swapper/1 Preemption disabled at: secondary_start_kernel+0xa1/0x130 Call Trace: ___might_sleep+0xe7/0xfc __might_sleep+0x41/0x44 synchronize_irq+0x24/0x64 disable_irq+0x11/0x14 ccount_timer_shutdown+0x12/0x20 clockevents_switch_state+0x82/0xb4 clockevents_exchange_device+0x54/0x60 tick_check_new_device+0x46/0x70 clockevents_register_device+0x8c/0xc8 clockevents_config_and_register+0x1d/0x2c local_timer_setup+0x75/0x7c secondary_start_kernel+0xb4/0x130 should_never_return+0x32/0x35 Use disable_irq_nosync instead of disable_irq to avoid it. This is safe because the ccount timer IRQ is per-CPU, and once IRQ is masked the ISR will not be called. Signed-off-by: Max Filippov Signed-off-by: Sasha Levin --- arch/xtensa/kernel/time.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c index be81e69b25bc..2251a6e0973a 100644 --- a/arch/xtensa/kernel/time.c +++ b/arch/xtensa/kernel/time.c @@ -89,7 +89,7 @@ static int ccount_timer_shutdown(struct clock_event_device *evt) container_of(evt, struct ccount_timer, evt); if (timer->irq_enabled) { - disable_irq(evt->irq); + disable_irq_nosync(evt->irq); timer->irq_enabled = 0; } return 0; -- 2.19.1