mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Michael Schmitz <schmitzmic@gmail.com>
To: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>
Cc: linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org, rostedt@goodmis.org
Subject: Re: [PATCH RFC 1/2] m68k: Add tracirqs
Date: Wed, 23 Oct 2024 20:30:11 +1300	[thread overview]
Message-ID: <4e93964e-bafb-0474-743f-8280c46898f4@gmail.com> (raw)
In-Reply-To: <86eea4de-2696-4485-9c16-cd3fbbd1aae6@yoseli.org>

Hi Jean-Michel,

Am 23.10.2024 um 18:53 schrieb Jean-Michel Hautbois:
> Hi Michael,
>
> On 23/10/2024 05:53, Michael Schmitz wrote:
>> Jean-Michel,
>>
>> thanks for your patches!
>>
>> Am 21.10.2024 um 22:44 schrieb Jean-Michel Hautbois:
>>> The TRACE_IRQFLAGS_SUPPORT requires the architecture to call
>>> trace_hardirqs_off() when interrupts are disabled and
>>> trace_hardirqs_on() when they are enabled.
>>> Add those calls to do_IRQ function.
>>
>> You will also have to add these calls to the three sites in arch/m68k/
>> coldfire/head.S where interrupts are enabled or disabled.
>
> Thanks for this ! I prepared a v2 with those calls added. I am wondering

Good -

> if my second patch is ok, I think it is not, could you please review it

I'll have to read up on how arch_stack_walk is supposed to work - have 
never seen that code before.

> ? There may already be something related to the stack in the assembly
> part useful to implement arch_stack_walk() in a different way ?

I doubt it

>>
>> Here:
>>> ENTRY(system_call)
>>>         SAVE_ALL_SYS
>>>         move    #0x2000,%sr             /* enable intrs again */
>>>         GET_CURRENT(%d2)
>>
>> and here:
>>> ret_from_exception:
>>>         move    #0x2700,%sr             /* disable intrs */
>>>         btst    #5,%sp@(PT_OFF_SR)      /* check if returning to
>>> kernel */
>>>         jeq     Luser_return            /* if so, skip resched,
>>> signals */
>>
>> and here:
>>> Lwork_to_do:
>>>         movel   %a0@(TINFO_FLAGS),%d1   /* get thread_info->flags */
>>>         move    #0x2000,%sr             /* enable intrs again */
>>>         btst    #TIF_NEED_RESCHED,%d1
>>>         jne     reschedule
>>
>> There's one similar site in arch/m68k/kernel/head.S
>> (ret_from_exception) where interrupts are enabled that would need a
>> similar change, if you want to enable this for all m68k.
>
> I won't be able to test it though ;-).
> I see there are a few interrupts disabling in
> arch/m68k/include/asm/entry.h too ?

Right - that's different in the coldfire stack save/restore macros. I 
missed that before.

Looks like wherever SAVE_ALL_SYS, SAVE_ALL_INT and RESTORE_USER are 
used, calls to trace_irqs_on/off() are required as well.

RESTORE_USER only restores the IPL in the CONFIG_COLDFIRE_SW_A7, which 
makes this a little tricky ... you might have to add these calls to the 
macros to get the correct behaviour.

>
>>
>> Registers %d0-%d5 and %a0-%a2 are saved on the stack at this point and
>> can be clobbered if need be.
>
> I don't know if they need to be clobbered...

I meant to say that if you need registers to prepare function arguments 
for trace_irqs_on/off() on the stack, these can be used. But that may 
not be necessary in this case.

Cheers,

	Michael


>
> Thanks,
> JM
>
>>
>> Cheers,
>>
>>      Michael
>>
>>
>>>
>>> Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois@yoseli.org>
>>> ---
>>>  arch/m68k/Kconfig      | 1 +
>>>  arch/m68k/kernel/irq.c | 2 ++
>>>  2 files changed, 3 insertions(+)
>>>
>>> diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
>>> index
>>> cc26df907bfe3c8143a931d259eceabb16af7411..ab3375475721fa63418c40d4ba6ac76679ebc77d
>>> 100644
>>> --- a/arch/m68k/Kconfig
>>> +++ b/arch/m68k/Kconfig
>>> @@ -39,6 +39,7 @@ config M68K
>>>      select OLD_SIGSUSPEND3
>>>      select UACCESS_MEMCPY if !MMU
>>>      select ZONE_DMA
>>> +    select TRACE_IRQFLAGS_SUPPORT
>>>
>>>  config CPU_BIG_ENDIAN
>>>      def_bool y
>>> diff --git a/arch/m68k/kernel/irq.c b/arch/m68k/kernel/irq.c
>>> index
>>> 9ab4f550342e5de11c528f55781432675ffd66bf..74cf60ebbc4bca51f3caa4046dbd2bdb02355711
>>> 100644
>>> --- a/arch/m68k/kernel/irq.c
>>> +++ b/arch/m68k/kernel/irq.c
>>> @@ -21,9 +21,11 @@ asmlinkage void do_IRQ(int irq, struct pt_regs *regs)
>>>  {
>>>      struct pt_regs *oldregs = set_irq_regs(regs);
>>>
>>> +    trace_hardirqs_off();
>>>      irq_enter();
>>>      generic_handle_irq(irq);
>>>      irq_exit();
>>> +    trace_hardirqs_on();
>>>
>>>      set_irq_regs(oldregs);
>>>  }
>>>
>

  reply	other threads:[~2024-10-23  7:30 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-21  9:44 [PATCH RFC 0/2] Add basic tracing support for m68k Jean-Michel Hautbois
2024-10-21  9:44 ` [PATCH RFC 1/2] m68k: Add tracirqs Jean-Michel Hautbois
2024-10-22  5:28   ` Steven Rostedt
2024-10-22  5:42     ` Jean-Michel Hautbois
2024-10-22  8:30       ` Steven Rostedt
2024-10-22  9:21         ` Jean-Michel Hautbois
2024-10-23  8:47           ` Steven Rostedt
2024-10-23  9:07             ` Jean-Michel Hautbois
2024-10-23  9:13               ` Geert Uytterhoeven
2024-10-23  9:31                 ` Jean-Michel Hautbois
2024-10-23 10:30                   ` Jean-Michel Hautbois
2024-10-23  3:53   ` Michael Schmitz
2024-10-23  5:53     ` Jean-Michel Hautbois
2024-10-23  7:30       ` Michael Schmitz [this message]
2024-10-23  8:59         ` Jean-Michel Hautbois
2024-10-23  9:27           ` Steven Rostedt
2024-10-23  8:51       ` Eero Tamminen
2024-10-21  9:44 ` [PATCH RFC 2/2] arch: m68k: Add STACKTRACE support Jean-Michel Hautbois
2024-11-27 11:26   ` Jean-Michel Hautbois
2024-12-02 14:41     ` Greg Ungerer
2024-12-02 14:51       ` Jean-Michel Hautbois
2024-12-02 14:52       ` Jean-Michel Hautbois
2024-12-02 23:01         ` Greg Ungerer
2024-12-03  6:25           ` Jean-Michel Hautbois
2024-12-02 17:53       ` Jean-Michel Hautbois
2024-11-15  8:26 ` [PATCH RFC 0/2] Add basic tracing support for m68k Jean-Michel Hautbois
2024-11-15 15:25   ` Steven Rostedt
2024-11-15 15:33     ` Jean-Michel Hautbois
2024-11-15 19:55       ` Steven Rostedt
2024-11-18 10:11         ` Jean-Michel Hautbois
2024-11-18 20:20           ` Steven Rostedt
2024-11-19 14:24             ` Jean-Michel Hautbois
2024-11-19 15:26               ` Steven Rostedt
2024-11-19 16:28                 ` Steven Rostedt
2024-11-19 16:44                   ` Steven Rostedt
2024-11-19 18:06                   ` Jean-Michel Hautbois
2024-11-19 18:10                     ` Steven Rostedt
2024-11-20 11:47                       ` Jean-Michel Hautbois
2024-11-20 15:31                         ` Steven Rostedt
2024-11-20 15:59                           ` Jean-Michel Hautbois
2024-11-20 16:43                             ` Steven Rostedt
2024-11-20 16:51                               ` Jean-Michel Hautbois
2024-11-19 18:25                     ` Michael Schmitz
2024-11-28 15:25           ` Tomas Glozar
2024-12-02 12:53             ` Jean-Michel Hautbois
2024-12-02 14:45               ` Tomas Glozar

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=4e93964e-bafb-0474-743f-8280c46898f4@gmail.com \
    --to=schmitzmic@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=jeanmichel.hautbois@yoseli.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    /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

all inboxes | Powered by JetHome®