Re: [PATCH 1/3] time: Add missing annotation to lock_hrtimer_base()

From: Thomas Gleixner
Date: Fri Jan 24 2020 - 17:04:56 EST


Jules,

Jules Irenge <jbi.octave@xxxxxxxxx> writes:

Please use the proper subsystem prefixes when sending patches.

git log --oneline path/to/file

gives you usally a pretty good hint.

> Sparse reports a warning at lock_hrtimer_base()
>
> |warning: context imbalance in lock_hrtimer_base() - wrong count at exit

This leading '|' is pointless

> |warning: context imbalance in hrtimer_start_range_ns() - unexpected unlock
> |warning: context imbalance in hrtimer_try_to_cancel() - unexpected unlock
> |warning: context imbalance in __hrtimer_get_remaining()
> |- unexpected unlock

How are the last 3 related to:

> Sparse reports a warning at lock_hrtimer_base()

?

> To fix this , an __acquires(timer) annotation is added.

Add the missing __acquires(timer) annotation.

Is precise and follows the recommendations of Documentation/process/...

> Given that lock_hrtimer_base() does actually call READ_ONCE(timer->base).

Given that the above sentence uses 'Given that' it should not terminate
right after explaining the 'Given'.

> This not only fixes the warnings but also improves on readability of
> the code.

I tend to disagree. In fact the annotation disturbes the reading flow
because it's on a separate line.

Can you please stop using this boilerplate which is neither helping
review nor giving someone who looks at the commit later on any useful
information?

Here is a suggestion for a change log for this:

Sparse reports several warnings;
warning: context imbalance in lock_hrtimer_base() - wrong count at exit
warning: context imbalance in hrtimer_start_range_ns() - unexpected unlock
warning: context imbalance in hrtimer_try_to_cancel() - unexpected unlock
warning: context imbalance in __hrtimer_get_remaining()- unexpected unlock

The root cause is a missing annotation of lock_hrtimer_base() which
causes also the 'unexpected unlock' warnings.

Add the missing __acquires(timer) annotation.

Hmm?

The other 2 patches of this series have similar issues. The futex
changelog is also horribly formatted.

Thanks,

tglx