From patchwork Wed Jul 11 11:24:22 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 141723 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp163216ljj; Wed, 11 Jul 2018 04:24:50 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdBsrroQm21Upw9c+qfy5PM/IrsD+mJrFCn4o+0FglwA67w/xsMLrckRqsw/tJ6EETWrQMF X-Received: by 2002:a17:902:7888:: with SMTP id q8-v6mr28570600pll.79.1531308290043; Wed, 11 Jul 2018 04:24:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531308290; cv=none; d=google.com; s=arc-20160816; b=GK7Zw+zr1gyANVCWgwrJyd3J5wFB5IJ6boU2+QtGKINW3ihY1InfcF4rxXp/+FyG2V z77fgEOLybRcsYrkxWYRxSY6EIwFIEa4bQ2SB8lrFKoO/kwMZjSZPZ2i4l41+juQc1ON ck3TSObFv6C8kZzom6E75BGFi51vYLGtjIed/Sb19VfSp8Y5NgnzykwBJwB/NUW7d/Eu 31ucuo5IqyDwzQUsBk3e5BkYDvhIjgLxVdqXmtFqRJEw4lHmpbErJPV15GirOF7ZHuGS Mnafak2KuorBQtpWpCEvUa1wh56nfVQvI0BiPQd2z73ZPxysX0qQL3jr9GIdP5C9diiN WbUw== 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:cc:to:from :arc-authentication-results; bh=D4URPSnnGzkGSaas52fxGjgON8CGlT8An0a7l2ybpGE=; b=v3L2VCCuSYP3hwnY9OcT4eIcYgrHkaUU/tCMTFUF0Fbv2oSIK30CgFYh3sjBKz3wjE KeI/catZgTIDE+8lzu4APQxCnl/BQmbvSkBZSOCMiGZDebJnN6DuN5uR3FKuPIlKNFUe ICaJBn4nk4yV2CVImF5HkE+HNBue5OuiPl3z2upVD5/gGY3zufoyauLKZzYrxQkF9Yh5 oK2whvDSIiryjAQxJGyklANBewz8twABXuCx6kv4gCBAJdB/HJPi0uCpR8ve7Wm3PeSM A8HRPbaJvHNxnwKLPRX+XZI0fmKKhN70+1HUWirOo4pZkd8A9cUVJfxTzXRjV1F4Z5GE 60kg== 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 w37-v6si18983868pgl.514.2018.07.11.04.24.49; Wed, 11 Jul 2018 04:24:50 -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 S1732796AbeGKL2j (ORCPT + 23 others); Wed, 11 Jul 2018 07:28:39 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:33670 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732586AbeGKL2i (ORCPT ); Wed, 11 Jul 2018 07:28:38 -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 EFBD380D; Wed, 11 Jul 2018 04:24:46 -0700 (PDT) Received: from usa.arm.com (unknown [10.1.210.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 776F63F589; Wed, 11 Jul 2018 04:24:45 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Sudeep Holla , Thomas Gleixner , Daniel Lezcano , Thierry Reding , Jonathan Hunter , Santosh Shilimkar Subject: [PATCH 1/3] clocksource: drivers: set clockevent device cpumask to cpu_possible_mask Date: Wed, 11 Jul 2018 12:24:22 +0100 Message-Id: <1531308264-24220-1-git-send-email-sudeep.holla@arm.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Currently, quite a few clockevent devices have cpumask set to cpu_all_mask which should be fine. However, cpu_possible_mask is more accurate and if there are any other clockevent devices in the system which have cpumask set to cpu_possible_mask, then having cpu_all_mask may result in issues (mostly boot hang with forever loops in clockevents_notify_released). So, lets replace all the clockevent device cpu_all_mask to cpu_possible_mask in order to prevent above mentioned possible issue. Cc: Daniel Lezcano Cc: Thomas Gleixner Cc: Thierry Reding Cc: Jonathan Hunter Cc: Santosh Shilimkar Signed-off-by: Sudeep Holla --- drivers/clocksource/tegra20_timer.c | 2 +- drivers/clocksource/timer-atcpit100.c | 2 +- drivers/clocksource/timer-keystone.c | 2 +- drivers/clocksource/zevio-timer.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) -- 2.7.4 diff --git a/drivers/clocksource/tegra20_timer.c b/drivers/clocksource/tegra20_timer.c index c337a8100a7b..dabf0a103567 100644 --- a/drivers/clocksource/tegra20_timer.c +++ b/drivers/clocksource/tegra20_timer.c @@ -230,7 +230,7 @@ static int __init tegra20_init_timer(struct device_node *np) return ret; } - tegra_clockevent.cpumask = cpu_all_mask; + tegra_clockevent.cpumask = cpu_possible_mask; tegra_clockevent.irq = tegra_timer_irq.irq; clockevents_config_and_register(&tegra_clockevent, 1000000, 0x1, 0x1fffffff); diff --git a/drivers/clocksource/timer-atcpit100.c b/drivers/clocksource/timer-atcpit100.c index 5e23d7b4a722..b4bd2f5b801d 100644 --- a/drivers/clocksource/timer-atcpit100.c +++ b/drivers/clocksource/timer-atcpit100.c @@ -185,7 +185,7 @@ static struct timer_of to = { .set_state_oneshot = atcpit100_clkevt_set_oneshot, .tick_resume = atcpit100_clkevt_shutdown, .set_next_event = atcpit100_clkevt_next_event, - .cpumask = cpu_all_mask, + .cpumask = cpu_possible_mask, }, .of_irq = { diff --git a/drivers/clocksource/timer-keystone.c b/drivers/clocksource/timer-keystone.c index 0eee03250cfc..f5b2eda30bf3 100644 --- a/drivers/clocksource/timer-keystone.c +++ b/drivers/clocksource/timer-keystone.c @@ -211,7 +211,7 @@ static int __init keystone_timer_init(struct device_node *np) event_dev->set_state_shutdown = keystone_shutdown; event_dev->set_state_periodic = keystone_set_periodic; event_dev->set_state_oneshot = keystone_shutdown; - event_dev->cpumask = cpu_all_mask; + event_dev->cpumask = cpu_possible_mask; event_dev->owner = THIS_MODULE; event_dev->name = TIMER_NAME; event_dev->irq = irq; diff --git a/drivers/clocksource/zevio-timer.c b/drivers/clocksource/zevio-timer.c index a6a0338eea77..f74689334f7c 100644 --- a/drivers/clocksource/zevio-timer.c +++ b/drivers/clocksource/zevio-timer.c @@ -162,7 +162,7 @@ static int __init zevio_timer_add(struct device_node *node) timer->clkevt.set_state_oneshot = zevio_timer_set_oneshot; timer->clkevt.tick_resume = zevio_timer_set_oneshot; timer->clkevt.rating = 200; - timer->clkevt.cpumask = cpu_all_mask; + timer->clkevt.cpumask = cpu_possible_mask; timer->clkevt.features = CLOCK_EVT_FEAT_ONESHOT; timer->clkevt.irq = irqnr; From patchwork Wed Jul 11 11:24:23 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sudeep Holla X-Patchwork-Id: 141724 Delivered-To: patch@linaro.org Received: by 2002:a2e:9754:0:0:0:0:0 with SMTP id f20-v6csp163228ljj; Wed, 11 Jul 2018 04:24:51 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf0S7epvWF9RpL1hRC5dgqY20CzQ90kNTW7pxBZAZqHGYFPGb9+PPFx/UhcQoxtSgBGYkLj X-Received: by 2002:a65:49c7:: with SMTP id t7-v6mr26485700pgs.23.1531308290961; Wed, 11 Jul 2018 04:24:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531308290; cv=none; d=google.com; s=arc-20160816; b=GpRjLliX+iccUZ6Y50GYj7ieso2APLZ0eJYrZbJnSWeFHdLzAmclFooHURy/Aem/tz 3w6YQp3I5I1SqpxzH1WLG/OlEisWsNd7bqC0CxpTcshzHyfpROnnvOHX+Ch82R+zIeF8 uoYOXzu+TO9dS28d9gMrDPUk46CM7C/NGUQHXtpYi4hBqTYXX/7N6sRjcuDYwBMd1NmF uVZmxUO+V7wPpxQTgiCq3uUkKN71/0tkAbTPzKLI70upjzOM57mO62NgExwGlmNw8+Fk N4UJ0PQ1R5Tl+OYsZzkSt3gJ4hm4sLqQlEUy1+I+oktZERmcy1/gOZi//DeDAMjyEMvb 5lAA== 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=mYgVWduSH10qw48zPIBN/o92fZVB9Dnx8hn7SnDBDTo=; b=lN//xtAAYZAtyLzDCy4rjbY6b+Hy4wXpScRmT9/zW6i7MRIjReFQgSUs1m/njZ7srR DNBs7VxahLVDOB4/b0Vm9N/pJ9z3nXWXeFJvP+067YEiThkrlwX33fAp1s2lYYhmNryX Um01YOMB2SidR4P5raf0HdcW0SzBJbVuO6i8tccrgYBk2hy8rtz7Tpy47Hkd8/gRIXn9 udyExAuz1GHGMZKlQuue8YAquED4E9YMx6Meh9WJPMY9qlCo1Cwf3aGfoxC1heSo+BGr RiwVnOb5wO5n9NhH/jQyXVoLifp1V9nB13Yn1v+UDRM/MKs7fEnkoegfAGf0/FDlh/rl Hg/Q== 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 w37-v6si18983868pgl.514.2018.07.11.04.24.50; Wed, 11 Jul 2018 04:24:50 -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 S1732810AbeGKL2k (ORCPT + 23 others); Wed, 11 Jul 2018 07:28:40 -0400 Received: from foss.arm.com ([217.140.101.70]:33690 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732586AbeGKL2j (ORCPT ); Wed, 11 Jul 2018 07:28:39 -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 2C4ED1682; Wed, 11 Jul 2018 04:24:48 -0700 (PDT) Received: from usa.arm.com (unknown [10.1.210.28]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 38FFD3F589; Wed, 11 Jul 2018 04:24:47 -0700 (PDT) From: Sudeep Holla To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Sudeep Holla , Thomas Gleixner Subject: [PATCH 2/3] tick: broadcast-hrtimer: use cpu_possible_mask for ce_broadcast_hrtimer Date: Wed, 11 Jul 2018 12:24:23 +0100 Message-Id: <1531308264-24220-2-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 This is the last instance of cpu_all_mask usage in the core framework. Lets replace it with cpu_possible_mask like all other instances in the clockevent drivers. This will now enable us to add warning in the core clockevents_register_device on usage of cpu_all_mask from any clockevent drivers in future. Cc: Thomas Gleixner Signed-off-by: Sudeep Holla --- kernel/time/tick-broadcast-hrtimer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/kernel/time/tick-broadcast-hrtimer.c b/kernel/time/tick-broadcast-hrtimer.c index 58045eb976c3..a59641fb88b6 100644 --- a/kernel/time/tick-broadcast-hrtimer.c +++ b/kernel/time/tick-broadcast-hrtimer.c @@ -90,7 +90,7 @@ static struct clock_event_device ce_broadcast_hrtimer = { .max_delta_ticks = ULONG_MAX, .mult = 1, .shift = 0, - .cpumask = cpu_all_mask, + .cpumask = cpu_possible_mask, }; static enum hrtimer_restart bc_handler(struct hrtimer *t) 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);