Re: Suspend/resume on i915 stop working between r278348 and r278741.

2015-02-16 Thread Ranjan1018 .
2015-02-16 10:50 GMT+01:00 Konstantin Belousov :

> On Sun, Feb 15, 2015 at 08:43:55PM +0100, Ranjan1018 . wrote:
> > 2015-02-15 19:59 GMT+01:00 Konstantin Belousov :
> >
> > > On Sun, Feb 15, 2015 at 07:45:44PM +0100, Ranjan1018 . wrote:
> > > >
> > > > Unfortunately does not work for me. Tested with r278803.
> > >
> > > Does your machine resume if you boot with hw.x2apic_enable set to 0
> > > from the loader prompt ?
> >
> > Yes. I have added to it to loader.conf
> > $ cat /boot/loader.conf | grep x2apic_enable
> > hw.x2apic_enable=0
> >
> >   Confirm that x2apic is disabled after tunable
> > > frobbing, with sysctl hw.apic.x2apic_mode.
> > >
> > $ sysctl hw.apic.x2apic_mode
> > hw.apic.x2apic_mode: 0
>
> And, does your machine resumed successfully with the tunable set ?
>
Yes.

>
> Below is the patch which seemingly worked for Gleb.
> You should not set the tunable to test it properly.
>
> diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
> index 13c3d43..b767691 100644
> --- a/sys/amd64/amd64/mp_machdep.c
> +++ b/sys/amd64/amd64/mp_machdep.c
> @@ -1507,6 +1507,7 @@ cpususpend_handler(void)
> vmm_resume_p();
>
> /* Resume MCA and local APIC */
> +   lapic_xapic_mode();
> mca_resume();
> lapic_setup(0);
>
> diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c
> index 32b9540..a80de54 100644
> --- a/sys/i386/i386/mp_machdep.c
> +++ b/sys/i386/i386/mp_machdep.c
> @@ -1555,6 +1555,7 @@ cpususpend_handler(void)
> cpu_ops.cpu_resume();
>
> /* Resume MCA and local APIC */
> +   lapic_xapic_mode();
> mca_resume();
> lapic_setup(0);
>
> diff --git a/sys/x86/acpica/acpi_wakeup.c b/sys/x86/acpica/acpi_wakeup.c
> index 74522be..e652419 100644
> --- a/sys/x86/acpica/acpi_wakeup.c
> +++ b/sys/x86/acpica/acpi_wakeup.c
> @@ -270,6 +270,7 @@ acpi_wakeup_machdep(struct acpi_softc *sc, int state,
> int sleep_result,
> initializecpu();
> PCPU_SET(switchtime, 0);
> PCPU_SET(switchticks, ticks);
> +   lapic_xapic_mode();
>  #ifdef SMP
> if (!CPU_EMPTY(&suspcpus))
> acpi_wakeup_cpus(sc);
> diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c
> index 1809fa6..1b66674 100644
> --- a/sys/x86/x86/local_apic.c
> +++ b/sys/x86/x86/local_apic.c
> @@ -527,7 +527,6 @@ native_lapic_xapic_mode(void)
> saveintr = intr_disable();
> if (x2apic_mode)
> native_lapic_enable_x2apic();
> -   native_lapic_disable();
> intr_restore(saveintr);
>  }
>
>
Thank you Konstantin, it works for me too!

I have commented 'hw.x2apic_enable=0' in /boot/loader.conf
$ cat /boot/loader.conf | grep x2apic_enable
#hw.x2apic_enable=0

the 2xapic result enabled
$ sysctl hw.apic.x2apic_mode
hw.apic.x2apic_mode: 1

and suspend/resume works again.

Regards
Maurizio
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Suspend/resume on i915 stop working between r278348 and r278741.

2015-02-16 Thread Konstantin Belousov
On Sun, Feb 15, 2015 at 08:43:55PM +0100, Ranjan1018 . wrote:
> 2015-02-15 19:59 GMT+01:00 Konstantin Belousov :
> 
> > On Sun, Feb 15, 2015 at 07:45:44PM +0100, Ranjan1018 . wrote:
> > >
> > > Unfortunately does not work for me. Tested with r278803.
> >
> > Does your machine resume if you boot with hw.x2apic_enable set to 0
> > from the loader prompt ?
> 
> Yes. I have added to it to loader.conf
> $ cat /boot/loader.conf | grep x2apic_enable
> hw.x2apic_enable=0
> 
>   Confirm that x2apic is disabled after tunable
> > frobbing, with sysctl hw.apic.x2apic_mode.
> >
> $ sysctl hw.apic.x2apic_mode
> hw.apic.x2apic_mode: 0

And, does your machine resumed successfully with the tunable set ?

Below is the patch which seemingly worked for Gleb.
You should not set the tunable to test it properly.

diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c
index 13c3d43..b767691 100644
--- a/sys/amd64/amd64/mp_machdep.c
+++ b/sys/amd64/amd64/mp_machdep.c
@@ -1507,6 +1507,7 @@ cpususpend_handler(void)
vmm_resume_p();
 
/* Resume MCA and local APIC */
+   lapic_xapic_mode();
mca_resume();
lapic_setup(0);
 
diff --git a/sys/i386/i386/mp_machdep.c b/sys/i386/i386/mp_machdep.c
index 32b9540..a80de54 100644
--- a/sys/i386/i386/mp_machdep.c
+++ b/sys/i386/i386/mp_machdep.c
@@ -1555,6 +1555,7 @@ cpususpend_handler(void)
cpu_ops.cpu_resume();
 
/* Resume MCA and local APIC */
+   lapic_xapic_mode();
mca_resume();
lapic_setup(0);
 
diff --git a/sys/x86/acpica/acpi_wakeup.c b/sys/x86/acpica/acpi_wakeup.c
index 74522be..e652419 100644
--- a/sys/x86/acpica/acpi_wakeup.c
+++ b/sys/x86/acpica/acpi_wakeup.c
@@ -270,6 +270,7 @@ acpi_wakeup_machdep(struct acpi_softc *sc, int state, int 
sleep_result,
initializecpu();
PCPU_SET(switchtime, 0);
PCPU_SET(switchticks, ticks);
+   lapic_xapic_mode();
 #ifdef SMP
if (!CPU_EMPTY(&suspcpus))
acpi_wakeup_cpus(sc);
diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c
index 1809fa6..1b66674 100644
--- a/sys/x86/x86/local_apic.c
+++ b/sys/x86/x86/local_apic.c
@@ -527,7 +527,6 @@ native_lapic_xapic_mode(void)
saveintr = intr_disable();
if (x2apic_mode)
native_lapic_enable_x2apic();
-   native_lapic_disable();
intr_restore(saveintr);
 }
 
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Suspend/resume on i915 stop working between r278348 and r278741.

2015-02-15 Thread Ranjan1018 .
2015-02-15 19:59 GMT+01:00 Konstantin Belousov :

> On Sun, Feb 15, 2015 at 07:45:44PM +0100, Ranjan1018 . wrote:
> >
> > Unfortunately does not work for me. Tested with r278803.
>
> Does your machine resume if you boot with hw.x2apic_enable set to 0
> from the loader prompt ?

Yes. I have added to it to loader.conf
$ cat /boot/loader.conf | grep x2apic_enable
hw.x2apic_enable=0

  Confirm that x2apic is disabled after tunable
> frobbing, with sysctl hw.apic.x2apic_mode.
>
$ sysctl hw.apic.x2apic_mode
hw.apic.x2apic_mode: 0
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Suspend/resume on i915 stop working between r278348 and r278741.

2015-02-15 Thread Gleb Smirnoff
On Sun, Feb 15, 2015 at 08:59:56PM +0200, Konstantin Belousov wrote:
K> On Sun, Feb 15, 2015 at 07:45:44PM +0100, Ranjan1018 . wrote:
K> > 
K> > Unfortunately does not work for me. Tested with r278803.
K> 
K> Does your machine resume if you boot with hw.x2apic_enable set to 0
K> from the loader prompt ?  Confirm that x2apic is disabled after tunable
K> frobbing, with sysctl hw.apic.x2apic_mode.

Just did that. Running r278473, hw.x2apic_enable=0 resume works,
and hw.x2apic_enable=1 resume reboots.

-- 
Totus tuus, Glebius.
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Suspend/resume on i915 stop working between r278348 and r278741.

2015-02-15 Thread Konstantin Belousov
On Sun, Feb 15, 2015 at 07:45:44PM +0100, Ranjan1018 . wrote:
> 
> Unfortunately does not work for me. Tested with r278803.

Does your machine resume if you boot with hw.x2apic_enable set to 0
from the loader prompt ?  Confirm that x2apic is disabled after tunable
frobbing, with sysctl hw.apic.x2apic_mode.
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Suspend/resume on i915 stop working between r278348 and r278741.

2015-02-15 Thread Gleb Smirnoff
On Sun, Feb 15, 2015 at 07:45:44PM +0100, Ranjan1018 . wrote:
R> > On Sun, Feb 15, 2015 at 03:37:17PM +0100, Ranjan1018 . wrote:
R> > > Hi,
R> > > the bug was introduced in r278473. Suspend/resume works again if I
R> > disable
R> > > the x2APIC support with hw.x2apic_enable=0 in /boot/loader.conf, tested
R> > in
R> > > r278473 and r278741.
R> >
R> > So how it is related to i915 ?
R> >
R> > Sorry, just my guess.
R> 
R> 
R> > Try the patch.
R> >
R> > diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c
R> > index 1809fa6..c8ea35e 100644
R> > --- a/sys/x86/x86/local_apic.c
R> > +++ b/sys/x86/x86/local_apic.c
R> > @@ -541,6 +541,9 @@ native_lapic_setup(int boot)
R> >
R> > saveintr = intr_disable();
R> >
R> > +   if (!boot && x2apic_mode)
R> > +   native_lapic_enable_x2apic();
R> > +
R> > la = &lapics[lapic_id()];
R> > KASSERT(la->la_present, ("missing APIC structure"));
R> > maxlvt = (lapic_read32(LAPIC_VERSION) & APIC_VER_MAXLVT) >>
R> > MAXLVTSHIFT;
R> >
R> 
R> Unfortunately does not work for me. Tested with r278803.

Me neither.

Also, I noticed that in my case the suspend sequence is also behaving
differently from pre-x2apic kernel.

With new kernel, suspend sequence doesn't switch from X to vt(4), screen
switches to black directly from X. So, probably the resume isn't broken
at all, instead suspend is broken: it puts machine in a state that can't
be resumed.

-- 
Totus tuus, Glebius.
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Suspend/resume on i915 stop working between r278348 and r278741.

2015-02-15 Thread Ranjan1018 .
2015-02-15 16:11 GMT+01:00 Konstantin Belousov :

> On Sun, Feb 15, 2015 at 03:37:17PM +0100, Ranjan1018 . wrote:
> > Hi,
> > the bug was introduced in r278473. Suspend/resume works again if I
> disable
> > the x2APIC support with hw.x2apic_enable=0 in /boot/loader.conf, tested
> in
> > r278473 and r278741.
>
> So how it is related to i915 ?
>
> Sorry, just my guess.


> Try the patch.
>
> diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c
> index 1809fa6..c8ea35e 100644
> --- a/sys/x86/x86/local_apic.c
> +++ b/sys/x86/x86/local_apic.c
> @@ -541,6 +541,9 @@ native_lapic_setup(int boot)
>
> saveintr = intr_disable();
>
> +   if (!boot && x2apic_mode)
> +   native_lapic_enable_x2apic();
> +
> la = &lapics[lapic_id()];
> KASSERT(la->la_present, ("missing APIC structure"));
> maxlvt = (lapic_read32(LAPIC_VERSION) & APIC_VER_MAXLVT) >>
> MAXLVTSHIFT;
>

Unfortunately does not work for me. Tested with r278803.

Regards,
Maurizio
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Suspend/resume on i915 stop working between r278348 and r278741.

2015-02-15 Thread Gleb Smirnoff
On Sat, Feb 14, 2015 at 10:31:18PM +0100, Ranjan1018 . wrote:
R> Just updated my Samsung Ativ Book 2, running 11-CURRENT, from r278348 to
R> r278741.
R> Now suspend via ‘acpiconf -s3’ does not work: the LCD stay dark, the
R> keyboard doesn't react when pressing CapsLock and I have to switch the
R> laptop off pressing the power button.

I have different issue: now suspend puts the laptop to sleep, but it
reboots on attempt to wake up.

I already narrowed down to: r278467 - r278490. Pretty sure, I'm going
to stop bisect near x2apic.

Will test kib@'s patch soon.

-- 
Totus tuus, Glebius.
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Re: Suspend/resume on i915 stop working between r278348 and r278741.

2015-02-15 Thread Konstantin Belousov
On Sun, Feb 15, 2015 at 03:37:17PM +0100, Ranjan1018 . wrote:
> Hi,
> the bug was introduced in r278473. Suspend/resume works again if I disable
> the x2APIC support with hw.x2apic_enable=0 in /boot/loader.conf, tested in
> r278473 and r278741.

So how it is related to i915 ?

Try the patch.

diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c
index 1809fa6..c8ea35e 100644
--- a/sys/x86/x86/local_apic.c
+++ b/sys/x86/x86/local_apic.c
@@ -541,6 +541,9 @@ native_lapic_setup(int boot)
 
saveintr = intr_disable();
 
+   if (!boot && x2apic_mode)
+   native_lapic_enable_x2apic();
+
la = &lapics[lapic_id()];
KASSERT(la->la_present, ("missing APIC structure"));
maxlvt = (lapic_read32(LAPIC_VERSION) & APIC_VER_MAXLVT) >> MAXLVTSHIFT;
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"


Re: Suspend/resume on i915 stop working between r278348 and r278741.

2015-02-15 Thread Ranjan1018 .
Hi,
the bug was introduced in r278473. Suspend/resume works again if I disable
the x2APIC support with hw.x2apic_enable=0 in /boot/loader.conf, tested in
r278473 and r278741.

Regards,
Maurizio  2015-02-15 2:03 GMT+01:00 Adrian Chadd :

> Hi,
>
> Can you narrow it down a little further please? That'd be really helpful.
>
> Thanks!
>
>
> -adrian
>
>
> On 14 February 2015 at 13:31, Ranjan1018 . <21474...@gmail.com> wrote:
> > Just updated my Samsung Ativ Book 2, running 11-CURRENT, from r278348 to
> > r278741.
> > Now suspend via ‘acpiconf -s3’ does not work: the LCD stay dark, the
> > keyboard doesn't react when pressing CapsLock and I have to switch the
> > laptop off pressing the power button.
> >
> > Regards,
> > Maurizio
> > ___
> > freebsd-current@freebsd.org mailing list
> > http://lists.freebsd.org/mailman/listinfo/freebsd-current
> > To unsubscribe, send any mail to "
> freebsd-current-unsubscr...@freebsd.org"
>
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Re: Suspend/resume on i915 stop working between r278348 and r278741.

2015-02-14 Thread Adrian Chadd
Hi,

Can you narrow it down a little further please? That'd be really helpful.

Thanks!


-adrian


On 14 February 2015 at 13:31, Ranjan1018 . <21474...@gmail.com> wrote:
> Just updated my Samsung Ativ Book 2, running 11-CURRENT, from r278348 to
> r278741.
> Now suspend via ‘acpiconf -s3’ does not work: the LCD stay dark, the
> keyboard doesn't react when pressing CapsLock and I have to switch the
> laptop off pressing the power button.
>
> Regards,
> Maurizio
> ___
> freebsd-current@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-current
> To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"

Suspend/resume on i915 stop working between r278348 and r278741.

2015-02-14 Thread Ranjan1018 .
Just updated my Samsung Ativ Book 2, running 11-CURRENT, from r278348 to
r278741.
Now suspend via ‘acpiconf -s3’ does not work: the LCD stay dark, the
keyboard doesn't react when pressing CapsLock and I have to switch the
laptop off pressing the power button.

Regards,
Maurizio
___
freebsd-current@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-current
To unsubscribe, send any mail to "freebsd-current-unsubscr...@freebsd.org"