linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH tip/sched/core] mm/early_ioremap: Adjust early_ioremap system_state check
@ 2017-06-14 19:11 Tom Lendacky
  2017-06-16 10:58 ` Thomas Gleixner
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Lendacky @ 2017-06-14 19:11 UTC (permalink / raw)
  To: linux-mm, linux-kernel; +Cc: Thomas Gleixner, Borislav Petkov, Ingo Molnar

A recent change added a new system_state value, SYSTEM_SCHEDULING, which
exposed a warning issued by early_ioreamp() when the system_state was not
SYSTEM_BOOTING. Since early_ioremap() can be called when the system_state
is SYSTEM_SCHEDULING, the check to issue the warning is changed from
system_state != SYSTEM_BOOTING to system_state >= SYSTEM_RUNNING.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
 mm/early_ioremap.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/early_ioremap.c b/mm/early_ioremap.c
index 6d5717b..57540de 100644
--- a/mm/early_ioremap.c
+++ b/mm/early_ioremap.c
@@ -103,7 +103,7 @@ static int __init check_early_ioremap_leak(void)
 	enum fixed_addresses idx;
 	int i, slot;
 
-	WARN_ON(system_state != SYSTEM_BOOTING);
+	WARN_ON(system_state >= SYSTEM_RUNNING);
 
 	slot = -1;
 	for (i = 0; i < FIX_BTMAPS_SLOTS; i++) {

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH tip/sched/core] mm/early_ioremap: Adjust early_ioremap system_state check
  2017-06-14 19:11 [PATCH tip/sched/core] mm/early_ioremap: Adjust early_ioremap system_state check Tom Lendacky
@ 2017-06-16 10:58 ` Thomas Gleixner
  2017-06-16 13:03   ` Tom Lendacky
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Gleixner @ 2017-06-16 10:58 UTC (permalink / raw)
  To: Tom Lendacky; +Cc: linux-mm, linux-kernel, Borislav Petkov, Ingo Molnar

On Wed, 14 Jun 2017, Tom Lendacky wrote:
> A recent change added a new system_state value, SYSTEM_SCHEDULING, which
> exposed a warning issued by early_ioreamp() when the system_state was not
> SYSTEM_BOOTING. Since early_ioremap() can be called when the system_state
> is SYSTEM_SCHEDULING, the check to issue the warning is changed from
> system_state != SYSTEM_BOOTING to system_state >= SYSTEM_RUNNING.

Errm, why is that early_ioremap() stuff called after we enabled the
scheduler? At that point the regular ioremap stuff is long working.

Thanks,

	tglx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH tip/sched/core] mm/early_ioremap: Adjust early_ioremap system_state check
  2017-06-16 10:58 ` Thomas Gleixner
@ 2017-06-16 13:03   ` Tom Lendacky
  2017-06-16 14:43     ` Tom Lendacky
  0 siblings, 1 reply; 4+ messages in thread
From: Tom Lendacky @ 2017-06-16 13:03 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: linux-mm, linux-kernel, Borislav Petkov, Ingo Molnar

On 6/16/2017 5:58 AM, Thomas Gleixner wrote:
> On Wed, 14 Jun 2017, Tom Lendacky wrote:
>> A recent change added a new system_state value, SYSTEM_SCHEDULING, which
>> exposed a warning issued by early_ioreamp() when the system_state was not
>> SYSTEM_BOOTING. Since early_ioremap() can be called when the system_state
>> is SYSTEM_SCHEDULING, the check to issue the warning is changed from
>> system_state != SYSTEM_BOOTING to system_state >= SYSTEM_RUNNING.
> 
> Errm, why is that early_ioremap() stuff called after we enabled the
> scheduler? At that point the regular ioremap stuff is long working.

As part of the SME support I'm decrypting the trampoline area during
set_real_mode_permissions().  Since it was still valid to use the
early_memremap()/early_ioremap() functions I chose to use those instead
of creating new ioremap functions to support encrypted or decrypted
mappings with and without write-protection.

I could look into adding new ioremap APIs, but their usage would be
limited to this one case.  Since the early_memremap() works I thought
that would be the best path and just adjust the WARNing condition.

Thanks,
Tom

> 
> Thanks,
> 
> 	tglx
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH tip/sched/core] mm/early_ioremap: Adjust early_ioremap system_state check
  2017-06-16 13:03   ` Tom Lendacky
@ 2017-06-16 14:43     ` Tom Lendacky
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Lendacky @ 2017-06-16 14:43 UTC (permalink / raw)
  To: Thomas Gleixner; +Cc: linux-mm, linux-kernel, Borislav Petkov, Ingo Molnar

On 6/16/2017 8:03 AM, Tom Lendacky wrote:
> On 6/16/2017 5:58 AM, Thomas Gleixner wrote:
>> On Wed, 14 Jun 2017, Tom Lendacky wrote:
>>> A recent change added a new system_state value, SYSTEM_SCHEDULING, which
>>> exposed a warning issued by early_ioreamp() when the system_state was 
>>> not
>>> SYSTEM_BOOTING. Since early_ioremap() can be called when the 
>>> system_state
>>> is SYSTEM_SCHEDULING, the check to issue the warning is changed from
>>> system_state != SYSTEM_BOOTING to system_state >= SYSTEM_RUNNING.
>>
>> Errm, why is that early_ioremap() stuff called after we enabled the
>> scheduler? At that point the regular ioremap stuff is long working.
> 
> As part of the SME support I'm decrypting the trampoline area during
> set_real_mode_permissions().  Since it was still valid to use the
> early_memremap()/early_ioremap() functions I chose to use those instead
> of creating new ioremap functions to support encrypted or decrypted
> mappings with and without write-protection.

Looking at this again, in setup_real_mode() I can update the trampoline
area with the proper encryption attributes using set_memory_decrypted()
before the trampoline area is copied and thus avoid having to decrypt
the area in-place.  With that I won't need to use the early_memremap()
functions.

So you can ignore this patch.

Thanks,
Tom

> 
> I could look into adding new ioremap APIs, but their usage would be
> limited to this one case.  Since the early_memremap() works I thought
> that would be the best path and just adjust the WARNing condition.
> 
> Thanks,
> Tom
> 
>>
>> Thanks,
>>
>>     tglx
>>
>>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-06-16 14:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-14 19:11 [PATCH tip/sched/core] mm/early_ioremap: Adjust early_ioremap system_state check Tom Lendacky
2017-06-16 10:58 ` Thomas Gleixner
2017-06-16 13:03   ` Tom Lendacky
2017-06-16 14:43     ` Tom Lendacky

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).