mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Linux Kernel list <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@osdl.org>
Subject: Re: swsusp_restore crap
Date: Wed, 16 Mar 2005 00:39:45 +0100	[thread overview]
Message-ID: <20050315233945.GF21292@elf.ucw.cz> (raw)
In-Reply-To: <200503152323.27793.rjw@sisk.pl>

Hi!

> > > Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
> > 
> > > diff -Nrup linux-2.6.11-bk10-a/arch/x86_64/kernel/suspend_asm.S linux-2.6.11-bk10-b/arch/x86_64/kernel/suspend_asm.S
> > > --- linux-2.6.11-bk10-a/arch/x86_64/kernel/suspend_asm.S	2005-03-15 09:20:53.000000000 +0100
> > > +++ linux-2.6.11-bk10-b/arch/x86_64/kernel/suspend_asm.S	2005-03-15 15:36:29.000000000 +0100
> > > @@ -69,6 +69,14 @@ loop:
> > >  	movq	pbe_next(%rdx), %rdx
> > >  	jmp	loop
> > >  done:
> > > +	/* Flush TLB, including "global" things (vmalloc) */
> > > +	movq	%rax, %rdx;  # mmu_cr4_features(%rip)
> > 
> > I somehow don't think %rax contains mmu_cr4_features at this
> > point. Otherwise it seems to look ok.
> 
> Yes, it does, because on x86-64 the TLBs are flushed before the loop,
> right after %cr3 is loaded with init_level4_pgt.  %rax is not touched
> afterwards, so it contains the right value.  Here's the relevant code
> from suspend_asm.S (with the patch applied):

Well, it is mmu_cr4_features from "old" kernel, while you are flushing
tlb in "new" kernel. It is probably same anyway, but.... %rax is
commonly-used scratch register, and memory load is not that
expensive. Can you just load it from memory?
								Pavel

> ENTRY(swsusp_arch_resume)
> 	/* set up cr3 */	
> 	leaq	init_level4_pgt(%rip),%rax
> 	subq	$__START_KERNEL_map,%rax
> 	movq	%rax,%cr3
> 
> 	movq	mmu_cr4_features(%rip), %rax
> 	movq	%rax, %rdx
> 	andq	$~(1<<7), %rdx	# PGE
> 	movq	%rdx, %cr4;  # turn off PGE
> 	movq	%cr3, %rcx;  # flush TLB
> 	movq	%rcx, %cr3;
> 	movq	%rax, %cr4;  # turn PGE back on
> 
> 	movq	pagedir_nosave(%rip), %rdx
> loop:
> 	testq	%rdx, %rdx
> 	jz	done
> 
> 	/* get addresses from the pbe and copy the page */
> 	movq	pbe_address(%rdx), %rsi
> 	movq	pbe_orig_address(%rdx), %rdi
> 	movq	$512, %rcx
> 	rep
> 	movsq
> 
> 	/* progress to the next pbe */
> 	movq	pbe_next(%rdx), %rdx
> 	jmp	loop
> done:
> 	/* Flush TLB, including "global" things (vmalloc) */
> 	movq	%rax, %rdx;  # mmu_cr4_features(%rip)
> 	andq	$~(1<<7), %rdx;  # PGE
> 	movq	%rdx, %cr4;  # turn off PGE
> 	movq	%cr3, %rcx;  # flush TLB
> 	movq	%rcx, %cr3
> 	movq	%rax, %cr4;  # turn PGE back on
> 
> 
> Greets,
> Rafael
> 
> 

-- 
People were complaining that M$ turns users into beta-testers...
...jr ghea gurz vagb qrirybcref, naq gurl frrz gb yvxr vg gung jnl!

  reply	other threads:[~2005-03-15 23:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-15  3:24 Benjamin Herrenschmidt
2005-03-15  3:31 ` Benjamin Herrenschmidt
2005-03-15 11:03   ` Pavel Machek
2005-03-15 11:51     ` Rafael J. Wysocki
2005-03-15 12:02       ` Pavel Machek
2005-03-15 13:27         ` Benjamin Herrenschmidt
2005-03-15 14:55         ` Rafael J. Wysocki
2005-03-15 20:46           ` Pavel Machek
2005-03-15 22:23             ` Rafael J. Wysocki
2005-03-15 23:39               ` Pavel Machek [this message]
2005-03-16  0:08                 ` Rafael J. Wysocki
2005-03-15 13:26       ` Benjamin Herrenschmidt

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=20050315233945.GF21292@elf.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=akpm@osdl.org \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rjw@sisk.pl \
    /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

all inboxes | Powered by JetHome®