update timer frequencies

2017-03-10 Thread Vlad Zakharov
Hello,

I am trying to implement a cpufreq driver for ARC CPUs. 
The point is that ARC timers (including those are used for timekeeping) are 
driven by the same clock as ARC CPU core(s).

So if cpufreq driver changes CPU frequency timers frequency also updates. 
I added notification handler to ARC timer driver were I attempted to update 
clocksource frequency with
"__clocksource_update_freq_hz()" but I found that actually the frequency didn't 
update. 

During my further investigation I mentioned that timekeeping framework doesn't 
allow frequency changes for more than
11%. This is quiet frustratingly: ARC cores supports such adjustments 
themselves but current framework API doesn't give
us a chance to use this functionality and in fact it even forbids CPU frequency 
changes in runtime at all.

Maybe I am mistaken and there is some way to get this going? Or maybe we can 
add some minor changes to timekeeping
framework to resolve this issue (special flag that allows such changes or 
something like this?).

Thanks.

-- 
Best regards,
Vlad Zakharov 
___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc

Re: update timer frequencies

2017-03-10 Thread Thomas Gleixner
Vlad,

On Fri, 10 Mar 2017, Vlad Zakharov wrote:
> 
> I am trying to implement a cpufreq driver for ARC CPUs.  The point is
> that ARC timers (including those are used for timekeeping) are driven by
> the same clock as ARC CPU core(s).

To be honest: That's broken by design and you really should go and tell
your hardware folks to fix that. Proper timekeeping is essential for any
Operating System (not only Linux).

It's well known for more than TWO decades that changing the frequency of
the timekeeper clocksource is a complete disaster, but obviously every
hardware vendor has to learn that the hard way instead of simply learning
from history.

> So if cpufreq driver changes CPU frequency timers frequency also
> updates. I added notification handler to ARC timer driver were I
> attempted to update clocksource frequency with
> "__clocksource_update_freq_hz()" but I found that actually the frequency
> didn't update.
> 
> During my further investigation I mentioned that timekeeping framework
> doesn't allow frequency changes for more than 11%. This is quiet
> frustratingly: ARC cores supports such adjustments themselves but current
> framework API doesn't give us a chance to use this functionality and in
> fact it even forbids CPU frequency changes in runtime at all.

It does not forbid CPU frequency changes. It forbids timekeeper clocksource
frequency jumps.

For a very good reason. Having frequency jumps disturbs timekeeping in
several ways (monotonic behaviour, accuracy).

> Maybe I am mistaken and there is some way to get this going? Or maybe we
> can add some minor changes to timekeeping framework to resolve this issue
> (special flag that allows such changes or something like this?).

No, we won't add a special flag because the availability will just
proliferate completely braindead hardware designs.

We had a gazillion of horrible hacks which tried to make this work in the
past, but none of them ever worked reliably under all circumstances. We
won't bring them back.

Your hardware design is broken by making the clocksource clock depend on
the CPU frequency. Tell your hardware people to fix that or just use a
seperate independent clocksource.

Thanks,

tglx

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


[PATCH 3.16 282/370] ARC: [arcompact] brown paper bag bug in unaligned access delay slot fixup

2017-03-10 Thread Ben Hutchings
3.16.42-rc1 review patch.  If anyone has any objections, please let me know.

--

From: Vineet Gupta 

commit a524c218bc94c705886a0e0fedeee45d1931da32 upstream.

Reported-by: Jo-Philipp Wich 
Fixes: 9aed02feae57bf7 ("ARC: [arcompact] handle unaligned access delay slot")
Cc: linux-ker...@vger.kernel.org
Cc: linux-snps-arc@lists.infradead.org
Signed-off-by: Vineet Gupta 
Signed-off-by: Linus Torvalds 
Signed-off-by: Ben Hutchings 
---
 arch/arc/kernel/unaligned.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/arch/arc/kernel/unaligned.c
+++ b/arch/arc/kernel/unaligned.c
@@ -242,7 +242,7 @@ int misaligned_fixup(unsigned long addre
 
/* clear any remanants of delay slot */
if (delay_mode(regs)) {
-   regs->ret = regs->bta ~1U;
+   regs->ret = regs->bta & ~1U;
regs->status32 &= ~STATUS_DE_MASK;
} else {
regs->ret += state.instr_len;


___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc


Re: [PATCH 03/20] asm-generic: Drop getrlimit and setrlimit syscalls from default list

2017-03-10 Thread Will Deacon
On Thu, Mar 02, 2017 at 12:49:11AM +0530, Yury Norov wrote:
> The newer prlimit64 syscall provides all the functionality provided by
> the getrlimit and setrlimit syscalls and adds the pid of target process,
> so future architectures won't need to include getrlimit and setrlimit.
> 
> Therefore drop getrlimit and setrlimit syscalls from the generic syscall
> list unless __ARCH_WANT_SET_GET_RLIMIT is defined by the architecture's
> unistd.h prior to including asm-generic/unistd.h, and adjust all architectures
> using the generic syscall list to define it so that no in-tree architectures
> are affected.
> 
> Cc: Arnd Bergmann 
> Cc: James Hogan 
> Cc: linux-a...@vger.kernel.org
> Cc: linux-snps-arc@lists.infradead.org
> Cc: Catalin Marinas 
> Cc: Will Deacon 
> Cc: linux-arm-ker...@lists.infradead.org
> Cc: Mark Salter 
> Cc: Aurelien Jacquiot 
> Cc: linux-c6x-...@linux-c6x.org
> Cc: Richard Kuo 
> Cc: linux-hexa...@vger.kernel.org
> Cc: linux-me...@vger.kernel.org
> Cc: Jonas Bonn 
> Cc: li...@lists.openrisc.net
> Cc: Chen Liqin 
> Cc: Lennox Wu 
> Cc: Chris Metcalf 
> Cc: Guan Xuetao 
> Cc: Ley Foon Tan 
> Cc: nios2-...@lists.rocketboards.org
> Cc: Yoshinori Sato 
> Cc: uclinux-h8-de...@lists.sourceforge.jp
> Acked-by: Arnd Bergmann 
> Acked-by: Mark Salter  [c6x]
> Acked-by: James Hogan  [metag]
> Acked-by: Ley Foon Tan  [nios2]
> Acked-by: Stafford Horne  [openrisc]
> Acked-by: Vineet Gupta  #arch/arc bits
> Signed-off-by: Yury Norov 
> ---
>  arch/arc/include/uapi/asm/unistd.h   | 1 +
>  arch/arm64/include/uapi/asm/unistd.h | 1 +
>  arch/c6x/include/uapi/asm/unistd.h   | 1 +
>  arch/h8300/include/uapi/asm/unistd.h | 1 +
>  arch/hexagon/include/uapi/asm/unistd.h   | 1 +
>  arch/metag/include/uapi/asm/unistd.h | 1 +
>  arch/nios2/include/uapi/asm/unistd.h | 1 +
>  arch/openrisc/include/uapi/asm/unistd.h  | 1 +
>  arch/score/include/uapi/asm/unistd.h | 1 +
>  arch/tile/include/uapi/asm/unistd.h  | 1 +
>  arch/unicore32/include/uapi/asm/unistd.h | 1 +
>  include/uapi/asm-generic/unistd.h| 5 +
>  12 files changed, 16 insertions(+)

For the arm64 part:

Acked-by: Will Deacon 

Will

___
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc