Re: [PATCH 5/8] powerpc/64: enable MSR[EE] in irq replay pt_regs
Excerpts from Sachin Sant's message of June 29, 2021 12:37 am: > >> On 28-Jun-2021, at 1:19 PM, Nicholas Piggin wrote: >> >> Similar to 2b48e96be2f9f ("powerpc/64: fix irq replay pt_regs->softe >> value"), enable MSR_EE in pt_regs->msr, which makes the regs look a >> bit more normal and allows the extra debug checks to be added to >> interrupt handler entry. >> >> Signed-off-by: Nicholas Piggin >> --- >> arch/powerpc/include/asm/interrupt.h | 4 >> arch/powerpc/kernel/irq.c| 1 + >> 2 files changed, 5 insertions(+) >> >> diff --git a/arch/powerpc/include/asm/interrupt.h >> b/arch/powerpc/include/asm/interrupt.h >> index 789311d1e283..d4bdf7d274ac 100644 >> --- a/arch/powerpc/include/asm/interrupt.h >> +++ b/arch/powerpc/include/asm/interrupt.h >> @@ -173,6 +173,8 @@ static inline void interrupt_enter_prepare(struct >> pt_regs *regs, struct interrup >> BUG_ON(search_kernel_restart_table(regs->nip)); >> #endif >> } >> +if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) >> +BUG_ON(!arch_irq_disabled_regs(regs) && !(regs->msr & MSR_EE)); >> #endif > > I think this BUG_ON was triggered while running selftests > (powerpc/mm/pkey_exec_prot) > > [ 9741.254969] [ cut here ] > [ 9741.254978] kernel BUG at arch/powerpc/include/asm/interrupt.h:177! > [ 9741.254985] Oops: Exception in kernel mode, sig: 5 [#1] > [ 9741.254990] LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries > [ 9741.254995] Modules linked in: rpadlpar_io rpaphp uinput sha512_generic > vmac n_gsm pps_ldisc pps_core ppp_synctty ppp_async ppp_generic slcan slip > slhc snd_hrtimer snd_seq snd_seq_device snd_timer snd soundcore authenc > pcrypt crypto_user n_hdlc dummy veth nfsv3 nfs_acl nfs lockd grace fscache > netfs tun brd overlay vfat fat btrfs blake2b_generic xor zstd_compress > raid6_pq xfs loop sctp ip6_udp_tunnel udp_tunnel dm_mod bonding nft_ct > nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip_set rfkill nf_tables libcrc32c > nfnetlink sunrpc pseries_rng xts vmx_crypto uio_pdrv_genirq uio sch_fq_codel > ip_tables ext4 mbcache jbd2 sr_mod sd_mod cdrom t10_pi sg ibmvscsi ibmveth > scsi_transport_srp fuse [last unloaded: test_cpuidle_latency] > [ 9741.255097] CPU: 17 PID: 3278920 Comm: pkey_exec_prot Tainted: GW > OE 5.13.0-rc7-next-20210625-dirty #4 > [ 9741.255106] NIP: c00300d8 LR: c0009604 CTR: > c0009330 > [ 9741.255111] REGS: c000347536f0 TRAP: 0700 Tainted: GW OE > (5.13.0-rc7-next-20210625-dirty) > [ 9741.255117] MSR: 80021033 CR: 22004282 XER: > 2004 > [ 9741.255130] CFAR: c003007c IRQMASK: 3 > [ 9741.255130] GPR00: c0093cd0 c00034753990 c29bbe00 > c00034753a30 > [ 9741.255130] GPR04: 7fff9ebb 0020 000a > 002d > [ 9741.255130] GPR08: 0001 > 7265677368657265 > [ 9741.255130] GPR12: 80021033 c0001ec27280 > > [ 9741.255130] GPR16: > > [ 9741.255130] GPR20: > 10003c40 > [ 9741.255130] GPR24: 0020 > c0005e89d200 > [ 9741.255130] GPR28: 0300 7fff9ebb c00034753e80 > c00034753a30 > [ 9741.255191] NIP [c00300d8] program_check_exception+0xe8/0x1c0 > [ 9741.255202] LR [c0009604] program_check_common_virt+0x2d4/0x320 > [ 9741.255209] Call Trace: > [ 9741.255212] [c00034753990] [0008] 0x8 (unreliable) > [ 9741.255219] [c000347539c0] [c00034753a80] 0xc00034753a80 > [ 9741.255225] --- interrupt: 700 at arch_local_irq_restore+0x1d0/0x200 > [ 9741.255231] NIP: c0016790 LR: c0093388 CTR: > c0008780 > [ 9741.255236] REGS: c00034753a30 TRAP: 0700 Tainted: GW OE > (5.13.0-rc7-next-20210625-dirty) > [ 9741.255242] MSR: 80021033 CR: 24004288 XER: > 2004 > [ 9741.255253] CFAR: c00165ec IRQMASK: 0 > [ 9741.255253] GPR00: c0093cd0 c00034753cd0 c29bbe00 > > [ 9741.255253] GPR04: 7fff9ebb 0020 000a > 002d > [ 9741.255253] GPR08: c000bd77d400 > 7265677368657265 > [ 9741.255253] GPR12: 44000282 c0001ec27280 > > [ 9741.255253] GPR16: > > [ 9741.255253] GPR20: > 10003c40 > [ 9741.255253] GPR24: 0020 > c0005e89d200 > [ 9741.255253] GPR28: 0300 7fff9ebb c00034753e80 > 0001 > [ 9741.255313] NIP [c0016790]
Re: [PATCH 5/8] powerpc/64: enable MSR[EE] in irq replay pt_regs
> On 28-Jun-2021, at 1:19 PM, Nicholas Piggin wrote: > > Similar to 2b48e96be2f9f ("powerpc/64: fix irq replay pt_regs->softe > value"), enable MSR_EE in pt_regs->msr, which makes the regs look a > bit more normal and allows the extra debug checks to be added to > interrupt handler entry. > > Signed-off-by: Nicholas Piggin > --- > arch/powerpc/include/asm/interrupt.h | 4 > arch/powerpc/kernel/irq.c| 1 + > 2 files changed, 5 insertions(+) > > diff --git a/arch/powerpc/include/asm/interrupt.h > b/arch/powerpc/include/asm/interrupt.h > index 789311d1e283..d4bdf7d274ac 100644 > --- a/arch/powerpc/include/asm/interrupt.h > +++ b/arch/powerpc/include/asm/interrupt.h > @@ -173,6 +173,8 @@ static inline void interrupt_enter_prepare(struct pt_regs > *regs, struct interrup > BUG_ON(search_kernel_restart_table(regs->nip)); > #endif > } > + if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG)) > + BUG_ON(!arch_irq_disabled_regs(regs) && !(regs->msr & MSR_EE)); > #endif I think this BUG_ON was triggered while running selftests (powerpc/mm/pkey_exec_prot) [ 9741.254969] [ cut here ] [ 9741.254978] kernel BUG at arch/powerpc/include/asm/interrupt.h:177! [ 9741.254985] Oops: Exception in kernel mode, sig: 5 [#1] [ 9741.254990] LE PAGE_SIZE=64K MMU=Hash SMP NR_CPUS=2048 NUMA pSeries [ 9741.254995] Modules linked in: rpadlpar_io rpaphp uinput sha512_generic vmac n_gsm pps_ldisc pps_core ppp_synctty ppp_async ppp_generic slcan slip slhc snd_hrtimer snd_seq snd_seq_device snd_timer snd soundcore authenc pcrypt crypto_user n_hdlc dummy veth nfsv3 nfs_acl nfs lockd grace fscache netfs tun brd overlay vfat fat btrfs blake2b_generic xor zstd_compress raid6_pq xfs loop sctp ip6_udp_tunnel udp_tunnel dm_mod bonding nft_ct nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 ip_set rfkill nf_tables libcrc32c nfnetlink sunrpc pseries_rng xts vmx_crypto uio_pdrv_genirq uio sch_fq_codel ip_tables ext4 mbcache jbd2 sr_mod sd_mod cdrom t10_pi sg ibmvscsi ibmveth scsi_transport_srp fuse [last unloaded: test_cpuidle_latency] [ 9741.255097] CPU: 17 PID: 3278920 Comm: pkey_exec_prot Tainted: GW OE 5.13.0-rc7-next-20210625-dirty #4 [ 9741.255106] NIP: c00300d8 LR: c0009604 CTR: c0009330 [ 9741.255111] REGS: c000347536f0 TRAP: 0700 Tainted: GW OE (5.13.0-rc7-next-20210625-dirty) [ 9741.255117] MSR: 80021033 CR: 22004282 XER: 2004 [ 9741.255130] CFAR: c003007c IRQMASK: 3 [ 9741.255130] GPR00: c0093cd0 c00034753990 c29bbe00 c00034753a30 [ 9741.255130] GPR04: 7fff9ebb 0020 000a 002d [ 9741.255130] GPR08: 0001 7265677368657265 [ 9741.255130] GPR12: 80021033 c0001ec27280 [ 9741.255130] GPR16: [ 9741.255130] GPR20: 10003c40 [ 9741.255130] GPR24: 0020 c0005e89d200 [ 9741.255130] GPR28: 0300 7fff9ebb c00034753e80 c00034753a30 [ 9741.255191] NIP [c00300d8] program_check_exception+0xe8/0x1c0 [ 9741.255202] LR [c0009604] program_check_common_virt+0x2d4/0x320 [ 9741.255209] Call Trace: [ 9741.255212] [c00034753990] [0008] 0x8 (unreliable) [ 9741.255219] [c000347539c0] [c00034753a80] 0xc00034753a80 [ 9741.255225] --- interrupt: 700 at arch_local_irq_restore+0x1d0/0x200 [ 9741.255231] NIP: c0016790 LR: c0093388 CTR: c0008780 [ 9741.255236] REGS: c00034753a30 TRAP: 0700 Tainted: GW OE (5.13.0-rc7-next-20210625-dirty) [ 9741.255242] MSR: 80021033 CR: 24004288 XER: 2004 [ 9741.255253] CFAR: c00165ec IRQMASK: 0 [ 9741.255253] GPR00: c0093cd0 c00034753cd0 c29bbe00 [ 9741.255253] GPR04: 7fff9ebb 0020 000a 002d [ 9741.255253] GPR08: c000bd77d400 7265677368657265 [ 9741.255253] GPR12: 44000282 c0001ec27280 [ 9741.255253] GPR16: [ 9741.255253] GPR20: 10003c40 [ 9741.255253] GPR24: 0020 c0005e89d200 [ 9741.255253] GPR28: 0300 7fff9ebb c00034753e80 0001 [ 9741.255313] NIP [c0016790] arch_local_irq_restore+0x1d0/0x200 [ 9741.255319] LR [c0093388] ___do_page_fault+0x438/0xb80 [ 9741.255325] --- interrupt: 700 [ 9741.255328] [c00034753cd0] [c009be74] hash_page_mm+0x5e4/0x800 (unreliable) [