public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andres Salomon <dilinger@queued.net>
To: Daniel Drake <dsd@laptop.org>,
	akpm@linux-foundation.org, linux-kernel@vger.kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH v4 resend] OLPC: Add XO-1 suspend/resume support
Date: Fri, 26 Nov 2010 11:29:20 -0800	[thread overview]
Message-ID: <20101126112920.48df6216@debxo> (raw)
In-Reply-To: <AANLkTikRoB2xmtwW=ddjJy-RdEpwrwT+5ngV3HC5t5k9@mail.gmail.com>

On Fri, 26 Nov 2010 16:28:51 +0000
Daniel Drake <dsd@laptop.org> wrote:

[...]
> Re. the printk thing, this was your doing:
> http://dev.laptop.org/git/olpc-2.6/commit/?h=stable&id=b4334e9e1444761f19806f9066c6b38ce23079bf
[...]
> ---------- Forwarded message ----------
> From: Thomas Gleixner <tglx@linutronix.de>
> Date: 26 November 2010 09:43
> Subject: Re: [PATCH v4 resend] OLPC: Add XO-1 suspend/resume support
> To: Daniel Drake <dsd@laptop.org>
> Cc: akpm@linux-foundation.org, linux-kernel@vger.kernel.org
> 
> 
> On Thu, 18 Nov 2010, Daniel Drake wrote:
> > Feedback after the first submission was quickly acted upon and I
> > haven't been able to get a peep since.
> 
> Sorry, fell off the radar.
> 
> > +
> > +wakeup_start:
> > +#    jmp wakeup_start
> 
>  Debug leftover ?


Leftovers from the original patch; certainly should be removed.


> 
> > +asmlinkage int olpc_xo1_do_sleep(u8 sleep_state)
> > +{
> > +     void *pgd_addr = __va(read_cr3());
> > +     printk(KERN_ERR "xo1_do_sleep!\n"); /* this needs to remain
> > here so
> > +                                           * that gcc doesn't
> > optimize
> > +                                           * away our __va! */
> > +
> 
>  This looks suspect along with the __volatile__ magic below. Care to
>  explain, what you fear that gcc is optimizing away ?
> 


I'm working from memory here; in the version of gcc we were using
at the time (stock FC5 or FC6), setting pgd_addr immediately followed
by the asm below resulted in gcc optimizing away the __va().  The asm
turned into simply:

movl %cr3, %eax

With no mention of PAGE_OFFSET.  Messing with 'volatile' didn't help.
Adding the printk did, as it causes %eax to get clobbered, forcing
temporary storage of %cr3 into a separate register.  A lot has changed
since then (compilers, this code, as well as the definition of
read_cr3()), so I highly suspect that it's no longer needed.
 

> > +     /* Enable wakeup through power button */
> > +     outl((CS5536_PM_PWRBTN << 16) | 0xFFFF, acpi_base + PM1_STS);
> > +
> > +     __asm__ __volatile__("movl %0,%%eax" : : "r" (pgd_addr));
> > +     __asm__("call *(%%edi); cld"
> > +             : : "D" (&ofw_bios_entry));
> > +     __asm__ __volatile__("movb $0x34, %al\n\t"
> > +                          "outb %al, $0x70\n\t"
> > +                          "movb $0x30, %al\n\t"
> > +                          "outb %al, $0x71\n\t");
> 
> Looks good otherwise.
> 
> Thanks,
> 
>        tglx


  parent reply	other threads:[~2010-11-26 19:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-18 20:28 [PATCH v4 resend] OLPC: Add XO-1 suspend/resume support Daniel Drake
2010-11-26  9:43 ` Thomas Gleixner
     [not found]   ` <AANLkTikRoB2xmtwW=ddjJy-RdEpwrwT+5ngV3HC5t5k9@mail.gmail.com>
2010-11-26 19:29     ` Andres Salomon [this message]
2010-12-03  0:57 ` Andrew Morton
2010-12-03  2:10   ` H. Peter Anvin

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=20101126112920.48df6216@debxo \
    --to=dilinger@queued.net \
    --cc=akpm@linux-foundation.org \
    --cc=dsd@laptop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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