linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sudeep Holla <sudeep.holla@arm.com>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Sudeep Holla <sudeep.holla@arm.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Marc Zyngier <marc.zyngier@arm.com>,
	Kevin Hilman <khilman@baylibre.com>,
	Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
	Mark Rutland <mark.rutland@arm.com>
Subject: Re: [PATCH 2/2] clocksource: arm_arch_timer: set arch_mem_timer cpumask to cpu_possible_mask
Date: Tue, 10 Jul 2018 14:25:52 +0100	[thread overview]
Message-ID: <a8979e78-9844-160a-a758-631505924bbd@arm.com> (raw)
In-Reply-To: <alpine.DEB.2.21.1807101419130.4356@nanos.tec.linutronix.de>



On 10/07/18 13:21, Thomas Gleixner wrote:
> On Tue, 10 Jul 2018, Sudeep Holla wrote:
> 
>>
>>
>> On 09/07/18 23:09, Thomas Gleixner wrote:
>>> On Mon, 9 Jul 2018, Sudeep Holla wrote:
>>>
>>>> Currently, arch_mem_timer cpumask is set to cpu_all_mask which should be
>>>> fine. However, cpu_possible_mask is more accurate and if there are other
>>>> clockevent source in the system which are set to cpu_possible_mask, then
>>>> having cpu_all_mask may result in issue.
>>>>
>>>> E.g. on a platform with arm,sp804 timer with rating 300 and
>>>> cpu_possible_mask and this arch_mem_timer timer with rating 400 and
>>>> cpu_all_mask, tick_check_preferred may choose both preferred as the
>>>> cpumasks are not equal though they must be.
>>>>
>>>> This issue was root caused incorrectly initially and a fix was merged as
>>>> commit 1332a9055801 ("tick: Prefer a lower rating device only if it's CPU
>>>> local device").
>>>
>>> To avoid that in the future we really should fix the decision logic to mask
>>> out the non possible CPUs from the supplied masks.
>>
>> Sure, I can do that. But do you want that as a fix for v4.18 ?
> 
> No, that's for 4.19
> 

Ah OK, I assume you are fine with this patch as fix for v4.18.
>> I think we may need this check at another place in tick_setup_device
>>
>> 213         /*
>> 214          * When the device is not per cpu, pin the interrupt to the
>> 215          * current cpu:
>> 216          */
>> 217         if (!cpumask_equal(newdev->cpumask, cpumask))
>> 218                 irq_set_affinity(newdev->irq, cpumask);
>>
>> Does it make sense trim dev->cpumask when registering the clockevents
>> device itself instead of adding check at place where this cpumask
>> can be used ? So that any future user of those masks need not have to
>> take care of that.
> 
> The problem is you cannot trim it because cpu_all_mask is global and const.
> 

Indeed, again forgot it just a pointer to the global one, duh!

>> Also only few ARM clocksource drivers use cpu_all_mask which could be
>> result of copy-paste, we can even fix them too.
>>
>> arm_arch_timer.c:	clk->cpumask = cpu_all_mask;
>> tegra20_timer.c:	tegra_clockevent.cpumask = cpu_all_mask;
>> timer-atcpit100.c:	.cpumask = cpu_all_mask,
>> timer-keystone.c:	event_dev->cpumask = cpu_all_mask;
>> zevio-timer.c:		timer->clkevt.cpumask	= cpu_all_mask;
> 
> Yes, that makes sense. What we could do is warn, when cpu_all_mask is set
> at registration time and replace the pointer with cpu_possible_mask.
> 

I like this approach than having to bitwise and with cpu_possible_mask
at all the necessary place. I will cook up a patch.
-- 
Regards,
Sudeep

  reply	other threads:[~2018-07-10 13:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-09 15:45 [PATCH 1/2] Revert "tick: Prefer a lower rating device only if it's CPU local device" Sudeep Holla
2018-07-09 15:45 ` [PATCH 2/2] clocksource: arm_arch_timer: set arch_mem_timer cpumask to cpu_possible_mask Sudeep Holla
2018-07-09 22:09   ` Thomas Gleixner
2018-07-10 10:29     ` Sudeep Holla
2018-07-10 12:21       ` Thomas Gleixner
2018-07-10 13:25         ` Sudeep Holla [this message]
2018-07-10 20:21           ` Thomas Gleixner
2018-07-10 20:16   ` [tip:timers/urgent] clocksource: arm_arch_timer: Set " tip-bot for Sudeep Holla
2018-07-09 18:24 ` [PATCH 1/2] Revert "tick: Prefer a lower rating device only if it's CPU local device" Kevin Hilman
2018-07-09 21:46   ` Martin Blumenstingl
2018-07-10 20:15 ` [tip:timers/urgent] " tip-bot for Sudeep Holla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a8979e78-9844-160a-a758-631505924bbd@arm.com \
    --to=sudeep.holla@arm.com \
    --cc=khilman@baylibre.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=martin.blumenstingl@googlemail.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).