From: Jarkko Sakkinen <jarkko@kernel.org>
To: Haitao Huang <haitao.huang@linux.intel.com>
Cc: Dave Hansen <dave.hansen@intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
x86@kernel.org, Reinette Chatre <reinette.chatre@intel.com>,
Paul Menzel <pmenzel@molgen.mpg.de>,
linux-sgx@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: WARNING: CPU: 1 PID: 83 at arch/x86/kernel/cpu/sgx/main.c:446 ksgxd+0x1b7/0x1d0
Date: Thu, 25 Aug 2022 08:49:50 +0300 [thread overview]
Message-ID: <YwcNfpLpzk8EIT88@kernel.org> (raw)
In-Reply-To: <op.1rfpqgjrwjvjmi@hhuan26-mobl1.mshome.net>
On Wed, Aug 24, 2022 at 09:12:06PM -0500, Haitao Huang wrote:
> Hi Paul
>
> On Tue, 23 Aug 2022 08:48:52 -0500, Paul Menzel <pmenzel@molgen.mpg.de>
> wrote:
>
> > Dear Dave,
> >
> >
> > Am 20.08.22 um 08:13 schrieb Paul Menzel:
> >
> > > Am 19.08.22 um 20:28 schrieb Dave Hansen:
> > > > On 8/19/22 09:02, Paul Menzel wrote:
> > > > > On the Dell XPS 13 9370, Linux 5.18.16 prints the warning below:
> > > > >
> > > > > ```
> > > > > [ 0.000000] Linux version 5.18.0-4-amd64
> > > > > (debian-kernel@lists.debian.org) (gcc-11 (Debian 11.3.0-5)
> > > > > 11.3.0, GNU ld (GNU Binutils for Debian) 2.38.90.20220713)
> > > > > #1 SMP PREEMPT_DYNAMIC Debian 5.18.16-1 (2022-08-10)
> > > > > [ 0.000000] Command line:
> > > > > BOOT_IMAGE=/vmlinuz-5.18.0-4-amd64
> > > > > root=UUID=56f398e0-1e25-4fda-aa9f-611dece4b333 ro quiet
> > > > > […]
> > > > > [ 0.000000] DMI: Dell Inc. XPS 13 9370/0RMYH9, BIOS
> > > > > 1.21.0 07/06/2022
> > > > > […]
> > > > > [ 0.235418] sgx: EPC section 0x40200000-0x45f7ffff
> > >
> > > > Would you be able to send the entire dmesg, along with:
> > > The log message are attached to the first message, where I missed
> > > to carbon-copy linux-sgx@ [1].
> > >
> > > > cat /proc/iomem # (as root)
> > > > and
> > > > cpuid -1 --raw
> > > I am going to provide that next week. (Side note, Intel might have
> > > some Dell XPS 9370 test machines in some QA lab.)
> >
> > Please find both outputs at the end of the file.
> >
>
> Could you also check output of "sudo rdmsr -x 0x3a"?
> Also was CONFIG_X86_SGX_KVM set?
>
> If CONFIG_X86_SGX_KVM is not set and bit 17 (SGX_LC) of the MSR 3A not set,
> then I think following sequence during sgx_init is possible:
>
> sgx_page_cache_init -> sgx_setup_epc_section
> ->put all physical EPC pages in sgx_dirty_page_list.
> Kick off ksgxd.
> Later, sgx_drv_init returns none-zero due to this check:
> if (!cpu_feature_enabled(X86_FEATURE_SGX_LC))
> return -ENODEV;
> sgx_vepc_init also returns none-zero if CONFIG_X86_SGX_KVM was not set.
>
> And sgx_init will call kthread_stop(ksgxd_tsk):
> ret = sgx_drv_init();
>
> if (sgx_vepc_init() && ret)
> goto err_provision;
> ...
> err_provision:
> misc_deregister(&sgx_dev_provision);
>
> err_kthread:
> kthread_stop(ksgxd_tsk);
>
>
> That triggers __sgx_sanitize_pages return early due to these lines:
> /* dirty_page_list is thread-local, no need for a lock: */
> while (!list_empty(dirty_page_list)) {
> if (kthread_should_stop())
> return;
>
> And that would trigger (depends on timing?) the warning in ksgxd due to
> non-empty sgx_dirty_page_list
> at that moment.
You're correct, and it's not a bug but completely legit behaviour.
And given that non-empty dirty page list is legit behavior WARN_ON()
is not what should be used in here.
Fix coming in a bit.
BR, Jarkko
next prev parent reply other threads:[~2022-08-25 5:50 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-19 13:19 WARNING: CPU: 1 PID: 83 at arch/x86/kernel/cpu/sgx/main.c:446 ksgxd+0x1b7/0x1d0 Paul Menzel
2022-08-19 16:02 ` Paul Menzel
2022-08-19 18:28 ` Dave Hansen
2022-08-20 6:13 ` Paul Menzel
2022-08-23 13:48 ` Paul Menzel
2022-08-23 16:32 ` Dave Hansen
2022-08-23 22:33 ` Paul Menzel
2022-08-24 18:39 ` Dave Hansen
2022-08-25 5:27 ` Jarkko Sakkinen
2022-08-25 2:12 ` Haitao Huang
2022-08-25 5:49 ` Jarkko Sakkinen [this message]
2022-08-25 8:34 ` Jarkko Sakkinen
2022-08-26 9:54 ` Paul Menzel
2022-08-25 4:57 ` Jarkko Sakkinen
2022-08-25 5:25 ` Jarkko Sakkinen
2022-08-25 6:46 ` Paul Menzel
2022-08-25 8:39 ` Jarkko Sakkinen
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=YwcNfpLpzk8EIT88@kernel.org \
--to=jarkko@kernel.org \
--cc=bp@alien8.de \
--cc=dave.hansen@intel.com \
--cc=haitao.huang@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sgx@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pmenzel@molgen.mpg.de \
--cc=reinette.chatre@intel.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.