Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Jun 2019 11:53:12 +0200
From:      Jan Martin Mikkelsen <janm@transactionware.com>
To:        Konstantin Belousov <kib@freebsd.org>
Cc:        Christian Ullrich <chris@chrullrich.net>, FreeBSD-STABLE Mailing List <freebsd-stable@freebsd.org>
Subject:   Re: efirtc causing panic (was Re: Panic booting 12-RC2 on amd64)
Message-ID:  <B6BA12DF-CFE3-44D9-B345-2331B2D829E9@transactionware.com>
In-Reply-To: <20190531183519.GF27392@kib.kiev.ua>
References:  <6e985fa2-c372-67ef-1cd5-dd8894cca908@chrullrich.net> <187B6A1E-5C61-415A-A9F2-B4E3142375C7@transactionware.com> <7E738A9B-A0B6-49D3-86A8-8E2F9ED8A098@transactionware.com> <20190531183519.GF27392@kib.kiev.ua>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

This patch resolves the panic when booting without efi.rt.disabled=3D1 =
for me.

Thanks!

Jan M.


> On 31 May 2019, at 20:35, Konstantin Belousov <kib@freebsd.org> wrote:
>=20
> On Fri, May 31, 2019 at 04:19:57PM +0200, Jan Martin Mikkelsen wrote:
>> Hi,
>>=20
>> Christian has pointed me at this =
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D233534 which he =
raised after his email. The workaround was to boot with =
=E2=80=9Cefi.rt.disabled=3D1=E2=80=9D.=20
>>=20
>> I took a closer look at what is going on. The problem is that the EFI =
rt_gettime call is faulting, and the fault is handled in efirt_support.S =
and a failure is reported. These messages is in the kernel output:
>>=20
>> kernel trap 12 with interrupts disabled
>> kernel trap 12 with interrupts disabled
>> EFI rt_gettime call faulted, error 14
>> efirtc0: cannot read EFI realtime clock, error 14
>>=20
>> So far, so good. The problem is that that later in startup the =
"smp_targeted_tlb_shootdown: interrupts disabled=E2=80=9D panic occurs, =
if the SMP is enabled. With SMP disabled this does not occur and the =
system runs.
>>=20
>> I=E2=80=99m not sure whether this is a BIOS problem (seems likely) or =
something that could handled after dealing with the fault in =
efirt_support.S.
>>=20
>> While looking I found the code below that looks wrong in efi_enter(), =
but that is not the problem in this case.
>>=20
>> Just adding this to the archive in case someone else looks more =
closely later.
>=20
> Try this.  Only compile-time tested.
>=20
> diff --git a/sys/amd64/amd64/efirt_support.S =
b/sys/amd64/amd64/efirt_support.S
> index cd578eddcfb..b54b13b01fe 100644
> --- a/sys/amd64/amd64/efirt_support.S
> +++ b/sys/amd64/amd64/efirt_support.S
> @@ -47,6 +47,9 @@ ENTRY(efi_rt_arch_call)
> 	movq	%r13, EC_R13(%rdi)
> 	movq	%r14, EC_R14(%rdi)
> 	movq	%r15, EC_R15(%rdi)
> +	pushfq
> +	popq	%rax
> +	movq	%rax, EC_RFLAGS(%rdi)
> 	movq	PCPU(CURTHREAD), %rax
> 	movq	%rdi, TD_MD+MD_EFIRT_TMP(%rax)
> 	movq	PCPU(CURPCB), %rsi
> @@ -98,6 +101,8 @@ efi_rt_arch_call_tail:
> 	movq	EC_RBP(%rdi), %rbp
> 	movq	EC_RSP(%rdi), %rsp
> 	movq	EC_RBX(%rdi), %rbx
> +	pushq	EC_RFLAGS(%rdi)
> +	popfq
>=20
> 	popq	%rbp
> 	ret
> diff --git a/sys/amd64/amd64/genassym.c b/sys/amd64/amd64/genassym.c
> index de3969734a1..2e81b823262 100644
> --- a/sys/amd64/amd64/genassym.c
> +++ b/sys/amd64/amd64/genassym.c
> @@ -272,3 +272,4 @@ ASSYM(EC_R12, offsetof(struct efirt_callinfo, =
ec_r12));
> ASSYM(EC_R13, offsetof(struct efirt_callinfo, ec_r13));
> ASSYM(EC_R14, offsetof(struct efirt_callinfo, ec_r14));
> ASSYM(EC_R15, offsetof(struct efirt_callinfo, ec_r15));
> +ASSYM(EC_RFLAGS, offsetof(struct efirt_callinfo, ec_rflags));
> diff --git a/sys/amd64/include/efi.h b/sys/amd64/include/efi.h
> index 082223792ac..e630a338c17 100644
> --- a/sys/amd64/include/efi.h
> +++ b/sys/amd64/include/efi.h
> @@ -72,6 +72,7 @@ struct efirt_callinfo {
> 	register_t	ec_r13;
> 	register_t	ec_r14;
> 	register_t	ec_r15;
> +	register_t	ec_rflags;
> };
>=20
> #endif /* __AMD64_INCLUDE_EFI_H_ */
> _______________________________________________
> freebsd-stable@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-stable
> To unsubscribe, send any mail to =
"freebsd-stable-unsubscribe@freebsd.org"




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?B6BA12DF-CFE3-44D9-B345-2331B2D829E9>