From: Artem Savkov <asavkov@redhat.com>
To: Joerg Roedel <joro@8bytes.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
iommu@lists.linux-foundation.org, x86@kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iommu/amd: Fix schedule-while-atomic BUG in initialization code
Date: Wed, 26 Jul 2017 15:25:05 +0200 [thread overview]
Message-ID: <20170726132505.cw4xmstcrbmuduyz@shodan.usersys.redhat.com> (raw)
In-Reply-To: <20170726122614.GP15833@8bytes.org>
On Wed, Jul 26, 2017 at 02:26:14PM +0200, Joerg Roedel wrote:
> Hi Artem, Thomas,
>
> On Wed, Jul 26, 2017 at 12:42:49PM +0200, Thomas Gleixner wrote:
> > On Tue, 25 Jul 2017, Artem Savkov wrote:
> >
> > > Hi,
> > >
> > > Commit 1c3c5ea "sched/core: Enable might_sleep() and smp_processor_id()
> > > checks early" seem to have uncovered an issue with amd-iommu/x2apic.
> > >
> > > Starting with that commit the following warning started to show up on AMD
> > > systems during boot:
> >
> > > [ 0.160000] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:747
> >
> > > [ 0.160000] mutex_lock_nested+0x1b/0x20
> > > [ 0.160000] register_syscore_ops+0x1d/0x70
> > > [ 0.160000] state_next+0x119/0x910
> > > [ 0.160000] iommu_go_to_state+0x29/0x30
> > > [ 0.160000] amd_iommu_enable+0x13/0x23
> > > [ 0.160000] irq_remapping_enable+0x1b/0x39
> > > [ 0.160000] enable_IR_x2apic+0x91/0x196
> > > [ 0.160000] default_setup_apic_routing+0x16/0x6e
> > > [ 0.160000] native_smp_prepare_cpus+0x257/0x2d5
>
> Thanks for the report!
>
> > --- a/drivers/iommu/amd_iommu_init.c
> > +++ b/drivers/iommu/amd_iommu_init.c
> > @@ -2440,7 +2440,6 @@ static int __init state_next(void)
> > break;
> > case IOMMU_ACPI_FINISHED:
> > early_enable_iommus();
> > - register_syscore_ops(&amd_iommu_syscore_ops);
> > x86_platform.iommu_shutdown = disable_iommus;
> > init_state = IOMMU_ENABLED;
> > break;
> > @@ -2559,6 +2558,8 @@ static int __init amd_iommu_init(void)
> > for_each_iommu(iommu)
> > iommu_flush_all_caches(iommu);
> > }
> > + } else {
> > + register_syscore_ops(&amd_iommu_syscore_ops);
> > }
> >
> > return ret;
>
> Yes, that should fix it, but I think its better to just move the
> register_syscore_ops() call to a later initialization step, like in the
> patch below. I tested it an will queue it to my iommu/fixes branch.
Checked it as well just in case, didn't see any issues. Thank you.
Reported-and-tested-by: Artem Savkov <asavkov@redhat.com>
--
Regards,
Artem
next prev parent reply other threads:[~2017-07-26 13:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-25 13:56 amd-iommu/x2apic: sleeping function called from invalid context Artem Savkov
[not found] ` <20170725135618.hev4vj7w24gm3a5q-TUG+jSMfqtFQcClZ3XN9yxcY2uh10dtjAL8bYrjMMd8@public.gmane.org>
2017-07-26 10:42 ` Thomas Gleixner
2017-07-26 12:26 ` [PATCH] iommu/amd: Fix schedule-while-atomic BUG in initialization code Joerg Roedel
2017-07-26 13:23 ` Thomas Gleixner
2017-07-26 13:25 ` Artem Savkov [this message]
2017-07-26 13:41 ` Joerg Roedel
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=20170726132505.cw4xmstcrbmuduyz@shodan.usersys.redhat.com \
--to=asavkov@redhat.com \
--cc=iommu@lists.linux-foundation.org \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).