From patchwork Wed Jul 11 11:24:24 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 141725 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp163259ljj; Wed, 11 Jul 2018 04:24:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf4GoKJnZL0fNAweIZ1asf+PU3OdfhV6+XkfQXNmi8pseA1UlHiP2mUSxQZWZW8k9jo7yaL X-Received: by 2002:a63:941a:: with SMTP id m26-v6mr11472604pge.82.1531308293139; Wed, 11 Jul 2018 04:24:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531308293; cv=none; d=google.com; s=arc-20160816; b=0mTx6WFpqQEAt8GjbRwd4BVYnyku6sTRKVvqgmpgO4Zu0J7iHkPiJ3jXfq83uLE/JD q34Nx+Qta0Fvi56b29Gymg/zpYM999UHozeOPgh+c8QoTIiNdpf6FTPYf6rsj3EI+CbD +/sda69v4TECdY3zJ6f8B2IHNT6mMoM3Ywg4zZOZm73rPrsO1CLsYQkQGwHR97A77p2J wdC16Hm3ehqZ6IDmadu0fcFmaki+LhvV+dU2D4Jls1OKWbLafuoWWkExbJmUjC1Wa++4 mAbTorSFdnvr9S6sRhctNHra4ZMbcxSYuWtIj6Ea94IHjbSpL1wCigqxLORTi0GXspAm SXlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=ZJQsg5y8tVPDPhwN8tgCTy/15gt7YjS0CHzlpzXpG0Q=; b=J3ff93DAQF5VHvWxWoq2Y5+5m9KdUfr1A60APDLhj+iyd1W9flUAVxYsbqX7OO0wK/ fAzqU1gvkQVTpg4SFvA8D0/spCwPOiUnxd8J+FlwQ6rTNe832apWJqTYHJnuMH2C6wIa fpH8smZ9FLsLzPxkrG2k9zSPno5lDPpLjEshdKzb/KRNwtBe/pmCSSHJ/kN7WbPp5bVM cfQs4gsJLEIq+mZz3JlszIJy/IsUOo+A5lTRcd9NJZSAT9x9iMvPmaJQ4Uel9v8dsvjo zhdJeozlbf68t8apGBqzpWKduvdXjTSLIdHBZ+Ahs0m0oIeBaehAi9Oj9sTWE/m2O9v/ MDdg== ARC-Authentication-Results: i=1; mx.google.com; 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 e9-v6si19636366plk.130.2018.07.11.04.24.52; Wed, 11 Jul 2018 04:24:53 -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; 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 S1732824AbeGKL2m (ORCPT + 23 others); Wed, 11 Jul 2018 07:28:42 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:33700 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732586AbeGKL2k (ORCPT ); Wed, 11 Jul 2018 07:28:40 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 54B04168F; Wed, 11 Jul 2018 04:24:49 -0700 (PDT) Received: from usa.arm.com (unknown [10.1.210.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 6A97D3F589; Wed, 11 Jul 2018 04:24:48 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Sudeep Holla , Thomas Gleixner Subject: [PATCH 3/3] clockevents: warn if cpu_all_mask is used for cpumask while registering new device Date: Wed, 11 Jul 2018 12:24:24 +0100 Message-Id: <1531308264-24220-3-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1531308264-24220-1-git-send-email-sudeep.holla@arm.com> References: <1531308264-24220-1-git-send-email-sudeep.holla@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Using cpu_all_mask in clockevents cpumask may result in issues while comparing multiple clockevent devices to choose the preferred one. On one of the platforms with 2 system(i.e. non per-CPU) timers with different ratings, having cpu_all_mask for one of the device resulted in boot hang with forever loop in clockevents_notify_released as both were being selected as preferred. In order to prevent such issues in future, let's warn if any clockevent drivers sets cpu_all_mask as it's cpumask and just override it to use cpu_possible_mask. All the existing occurrences of cpu_all_mask are already replaced with cpu_possible_mask. Cc: Thomas Gleixner Signed-off-by: Sudeep Holla --- kernel/time/clockevents.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.7.4 diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index 16c027e9cc73..8c0e4092f661 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c @@ -463,6 +463,12 @@ void clockevents_register_device(struct clock_event_device *dev) dev->cpumask = cpumask_of(smp_processor_id()); } + if (dev->cpumask == cpu_all_mask) { + WARN(1, "%s cpumask == cpu_all_mask, using cpu_possible_mask instead\n", + dev->name); + dev->cpumask = cpu_possible_mask; + } + raw_spin_lock_irqsave(&clockevents_lock, flags); list_add(&dev->list, &clockevent_devices);