Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2040020imm; Thu, 24 May 2018 04:59:06 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpPVCN17RVmm7enDfhiy/NmbuUW6WHoK43gnQLKci/INQ6DPxB2iHkTEM0R7t8h7HOkZ3GT X-Received: by 2002:a63:6c03:: with SMTP id h3-v6mr593518pgc.28.1527163145998; Thu, 24 May 2018 04:59:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527163145; cv=none; d=google.com; s=arc-20160816; b=N3p5KJnm0Kx75Br3fIQjIr3OVHYHGpvg+Yyv0HlfxEEtaeq7/rVrX8D+OV/unsFhXT J7ytixoSA3780cSyFbXUfKrw7Iuq+FXIPSsn7ACIv7IWkN2UtxKn7EvxaKTGzSkrSTZR rHyC9p23Ei2I/azilfYMjDmNvdylTbpLv2RmdvOdOv3PPq0ejjFBDr3PTC0kldGkgU10 vWXleZhnRyKd7C+GfzVphq+oTC0v5eQA4BX1i5rY+49rRAnanaz8Eu4aaZD31/snek5I gzW9gCJajZoyUHm6yajhN4onsUdvIBCPKfqckG7G2oBikgoZWTCzoweqN+T7leUTI608 ooCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=ebp+fBdd9hA4rSax4+rb1j1Dgj8I8UDIWwKebeAlAoo=; b=nCDq63+VVsSGc4slczXxJroPAQpOiCjezGQdYCaGjk/jKFepU4fjDyenaWO+yQwpfU x/WCjiZYmqtA/9+kFqFvDtiGjBfPUF3/XmOhEL4U5evM3BRJVevAURCehoR1/Uk6g314 wzEKDWE4kvuVjb1duEEjAvAYTkpfNL3JD1vSUYbaStxn9uFUjX5KoFLIS2N8rKw1YIu0 YOydiQr5N6YjoMzkLqA3zx5UdIwbeQNwWwY8UfOb/gLXVmNV0pdlEFdMk4QEWuhIgZWz H6wuqh/4tiN0mryj7sFU5jaBBsZtNZPY3VuRNPAJbavGXNMdguRN7Vu8NWTAgcxtVvQ0 Inzw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=biXDH3OP; 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 h67-v6si21545477pfk.15.2018.05.24.04.58.51; Thu, 24 May 2018 04:59:05 -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=biXDH3OP; 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 S969486AbeEXL6N (ORCPT + 99 others); Thu, 24 May 2018 07:58:13 -0400 Received: from mail.kernel.org ([198.145.29.99]:56612 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966786AbeEXJp0 (ORCPT ); Thu, 24 May 2018 05:45:26 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 74DB4208CE; Thu, 24 May 2018 09:45:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155126; bh=NLE5O+YwYbW9l9WPZ1C0jMP4tNfHSsmkTekL+S4V6Ss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=biXDH3OP2pmbMsEePL1E2ZuIQVZOlpSjHCA3Fcp+pcjTvol+2NViKBav3BbKNSuRj q0AWNpIghWv5HdKDgCLAYHFKirNH4CYHroXjF0gT6ALylJHOCB9TjxGtRzTyu8jqau UFfZ3S94kkk2RK8QCzj2PvhjoM2B9i+IiLEawm18= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dexuan Cui , Thomas Gleixner , Josh Poulson , "Michael Kelley (EOSG)" , Peter Zijlstra , Frederic Weisbecker , Rakib Mullick , Jork Loeser , Andrew Morton , KY Srinivasan , Linus Torvalds , Alexey Dobriyan , Dmitry Vyukov Subject: [PATCH 4.4 64/92] tick/broadcast: Use for_each_cpu() specially on UP kernels Date: Thu, 24 May 2018 11:38:41 +0200 Message-Id: <20180524093205.462096885@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093159.286472249@linuxfoundation.org> References: <20180524093159.286472249@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 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 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dexuan Cui commit 5596fe34495cf0f645f417eb928ef224df3e3cb4 upstream. for_each_cpu() unintuitively reports CPU0 as set independent of the actual cpumask content on UP kernels. This causes an unexpected PIT interrupt storm on a UP kernel running in an SMP virtual machine on Hyper-V, and as a result, the virtual machine can suffer from a strange random delay of 1~20 minutes during boot-up, and sometimes it can hang forever. Protect if by checking whether the cpumask is empty before entering the for_each_cpu() loop. [ tglx: Use !IS_ENABLED(CONFIG_SMP) instead of #ifdeffery ] Signed-off-by: Dexuan Cui Signed-off-by: Thomas Gleixner Cc: Josh Poulson Cc: "Michael Kelley (EOSG)" Cc: Peter Zijlstra Cc: Frederic Weisbecker Cc: stable@vger.kernel.org Cc: Rakib Mullick Cc: Jork Loeser Cc: Greg Kroah-Hartman Cc: Andrew Morton Cc: KY Srinivasan Cc: Linus Torvalds Cc: Alexey Dobriyan Cc: Dmitry Vyukov Link: https://lkml.kernel.org/r/KL1P15301MB000678289FE55BA365B3279ABF990@KL1P15301MB0006.APCP153.PROD.OUTLOOK.COM Link: https://lkml.kernel.org/r/KL1P15301MB0006FA63BC22BEB64902EAA0BF930@KL1P15301MB0006.APCP153.PROD.OUTLOOK.COM Signed-off-by: Greg Kroah-Hartman --- kernel/time/tick-broadcast.c | 8 ++++++++ 1 file changed, 8 insertions(+) --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -610,6 +610,14 @@ static void tick_handle_oneshot_broadcas now = ktime_get(); /* Find all expired events */ for_each_cpu(cpu, tick_broadcast_oneshot_mask) { + /* + * Required for !SMP because for_each_cpu() reports + * unconditionally CPU0 as set on UP kernels. + */ + if (!IS_ENABLED(CONFIG_SMP) && + cpumask_empty(tick_broadcast_oneshot_mask)) + break; + td = &per_cpu(tick_cpu_device, cpu); if (td->evtdev->next_event.tv64 <= now.tv64) { cpumask_set_cpu(cpu, tmpmask);