100-avr32-balance-cpu_idle_poll_ctrl-calls.patch 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. From 1b2bdd19742d4a336a4865d9b352c7a0ca7028ee Mon Sep 17 00:00:00 2001
  2. From: Gabor Juhos <[email protected]>
  3. Date: Wed, 25 Sep 2013 10:00:10 +0200
  4. Subject: [PATCH] avr32: balance cpu_idle_poll_ctrl calls
  5. Since commit 01426478df3a8791ff5c8b6b82d409e699cfaf38
  6. (avr32: Use generic idle loop) the kernel throws the
  7. following warning on avr32:
  8. WARNING: at 900322e4 [verbose debug info unavailable]
  9. Modules linked in:
  10. CPU: 0 PID: 0 Comm: swapper Not tainted 3.12.0-rc2 #117
  11. task: 901c3ecc ti: 901c0000 task.ti: 901c0000
  12. PC is at cpu_idle_poll_ctrl+0x1c/0x38
  13. LR is at comparator_mode+0x3e/0x40
  14. pc : [<900322e4>] lr : [<90014882>] Not tainted
  15. sp : 901c1f74 r12: 00000000 r11: 901c74a0
  16. r10: 901d2510 r9 : 00000001 r8 : 901db4de
  17. r7 : 901c74a0 r6 : 00000001 r5 : 00410020 r4 : 901db574
  18. r3 : 00410024 r2 : 90206fe0 r1 : 00000000 r0 : 007f0000
  19. Flags: qvnzc
  20. Mode bits: hjmde....G
  21. CPU Mode: Supervisor
  22. Call trace:
  23. [<90039ede>] clockevents_set_mode+0x16/0x2e
  24. [<90039f00>] clockevents_shutdown+0xa/0x1e
  25. [<9003a078>] clockevents_exchange_device+0x58/0x70
  26. [<9003a78c>] tick_check_new_device+0x38/0x54
  27. [<9003a1a2>] clockevents_register_device+0x32/0x90
  28. [<900035c4>] time_init+0xa8/0x108
  29. [<90000520>] start_kernel+0x128/0x23c
  30. When the 'avr32_comparator' clockevent device is registered,
  31. the clockevent core sets the mode of that clockevent device
  32. to CLOCK_EVT_MODE_SHUTDOWN. Due to this, the 'comparator_mode'
  33. function calls the 'cpu_idle_poll_ctrl' to disables idle poll.
  34. This results in the aforementioned warning because the polling
  35. is not enabled yet.
  36. Change the code to only disable idle poll if it is enabled by
  37. the same function to avoid the warning.
  38. Cc: [email protected]
  39. Signed-off-by: Gabor Juhos <[email protected]>
  40. ---
  41. Note: the patch is against v3.12-rc2.
  42. ---
  43. arch/avr32/kernel/time.c | 9 ++++++++-
  44. 1 file changed, 8 insertions(+), 1 deletion(-)
  45. --- a/arch/avr32/kernel/time.c
  46. +++ b/arch/avr32/kernel/time.c
  47. @@ -98,7 +98,14 @@ static void comparator_mode(enum clock_e
  48. case CLOCK_EVT_MODE_SHUTDOWN:
  49. sysreg_write(COMPARE, 0);
  50. pr_debug("%s: stop\n", evdev->name);
  51. - cpu_idle_poll_ctrl(false);
  52. + if (evdev->mode == CLOCK_EVT_MODE_ONESHOT ||
  53. + evdev->mode == CLOCK_EVT_MODE_RESUME) {
  54. + /*
  55. + * Only disable idle poll if we have forced that
  56. + * in a previous call.
  57. + */
  58. + cpu_idle_poll_ctrl(false);
  59. + }
  60. break;
  61. default:
  62. BUG();