Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1696983

Re: amd-iommu/x2apic: sleeping function called from invalid context

From Thomas Gleixner <tglx@linutronix.de>
Newsgroups linux.kernel
Subject Re: amd-iommu/x2apic: sleeping function called from invalid context
Date 2017-07-26 12:50 +0200
Message-ID <u7s39-7CE-39@gated-at.bofh.it> (permalink)
References <u78xr-3uy-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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 

Yep, that's clearly stupid. The completely untested patch below should cure
the issue.

Thanks,

	tglx

8<---------------	
	
--- 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;

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

amd-iommu/x2apic: sleeping function called from invalid context Artem Savkov <asavkov@redhat.com> - 2017-07-25 16:00 +0200
  Re: amd-iommu/x2apic: sleeping function called from invalid  context Thomas Gleixner <tglx@linutronix.de> - 2017-07-26 12:50 +0200
    [PATCH] iommu/amd: Fix schedule-while-atomic BUG in initialization  code Joerg Roedel <joro@8bytes.org> - 2017-07-26 14:30 +0200
      Re: [PATCH] iommu/amd: Fix schedule-while-atomic BUG in  initialization code Artem Savkov <asavkov@redhat.com> - 2017-07-26 15:30 +0200
        Re: [PATCH] iommu/amd: Fix schedule-while-atomic BUG in  initialization code Joerg Roedel <joro@8bytes.org> - 2017-07-26 15:50 +0200
      Re: [PATCH] iommu/amd: Fix schedule-while-atomic BUG in initialization  code Thomas Gleixner <tglx@linutronix.de> - 2017-07-26 15:30 +0200

csiph-web