All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0 of 3] Patches for Xen 4.2 (v2).
@ 2012-04-02 20:27 Konrad Rzeszutek Wilk
  2012-04-02 20:27 ` [PATCH 1 of 3] xen/vga: Add 'vga_delay' parameter to delay screen output by X miliseconds per line Konrad Rzeszutek Wilk
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Konrad Rzeszutek Wilk @ 2012-04-02 20:27 UTC (permalink / raw)
  To: xen-devel, Ian.Jackson, stefano.stabellini, Ian.Campbell, jbeulich
  Cc: konrad.wilk

Patches that were posted last week - with review comments
addressed.

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

* [PATCH 1 of 3] xen/vga: Add 'vga_delay' parameter to delay screen output by X miliseconds per line
  2012-04-02 20:27 [PATCH 0 of 3] Patches for Xen 4.2 (v2) Konrad Rzeszutek Wilk
@ 2012-04-02 20:27 ` Konrad Rzeszutek Wilk
  2012-04-03  7:14   ` Jan Beulich
  2012-04-03  8:07   ` Ian Campbell
  2012-04-02 20:27 ` [PATCH 2 of 3] xen/pat: After suspend re-write PAT if BIOS changed it Konrad Rzeszutek Wilk
  2012-04-02 20:27 ` [PATCH 3 of 3] xend: Don't crash due to weird PCI devices Konrad Rzeszutek Wilk
  2 siblings, 2 replies; 7+ messages in thread
From: Konrad Rzeszutek Wilk @ 2012-04-02 20:27 UTC (permalink / raw)
  To: xen-devel, Ian.Jackson, stefano.stabellini, Ian.Campbell, jbeulich
  Cc: konrad.wilk

# HG changeset patch
# User Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
# Date 1333398408 14400
# Node ID f1da2ce71ed41d1b74ebe6916ff7710d6579438e
# Parent  1088c8557a46ab28e509bb9482e2a73a21590df8
xen/vga: Add 'vga_delay' parameter to delay screen output by X miliseconds per line.

This is useful if you find yourself on machine that has no serial console,
nor any PCI, PCIe to put in a serial card. Nothing really fancy except it allows
to capture the screenshot of the screen using a camera.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

diff -r 1088c8557a46 -r f1da2ce71ed4 xen/drivers/video/vga.c
--- a/xen/drivers/video/vga.c	Fri Mar 30 21:05:54 2012 +0100
+++ b/xen/drivers/video/vga.c	Mon Apr 02 16:26:48 2012 -0400
@@ -10,7 +10,7 @@
 #include <xen/mm.h>
 #include <xen/vga.h>
 #include <asm/io.h>
-
+#include <xen/delay.h>
 /* Filled in by arch boot code. */
 struct xen_vga_console_info vga_console_info;
 
@@ -49,6 +49,12 @@ void (*vga_puts)(const char *) = vga_noo
 static char __initdata opt_vga[30] = "";
 string_param("vga", opt_vga);
 
+/*
+ * 'vga_delay=miliseconds' which defines to delay to print a line
+ * to the screen. 2 is a a good value to get a good screen output.
+ */
+unsigned int __read_mostly vga_delay;
+integer_param("vga_delay", vga_delay);
 /* VGA text-mode definitions. */
 static unsigned int columns, lines;
 #define ATTRIBUTE   7
@@ -135,6 +141,9 @@ static void vga_text_puts(const char *s)
                 ypos = lines - 1;
                 memmove(video, video + 2 * columns, ypos * 2 * columns);
                 memset(video + ypos * 2 * columns, 0, 2 * xpos);
+                if (vga_delay)
+                    mdelay(vga_delay);
+
             }
             xpos = 0;
         }

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

* [PATCH 2 of 3] xen/pat: After suspend re-write PAT if BIOS changed it
  2012-04-02 20:27 [PATCH 0 of 3] Patches for Xen 4.2 (v2) Konrad Rzeszutek Wilk
  2012-04-02 20:27 ` [PATCH 1 of 3] xen/vga: Add 'vga_delay' parameter to delay screen output by X miliseconds per line Konrad Rzeszutek Wilk
@ 2012-04-02 20:27 ` Konrad Rzeszutek Wilk
  2012-04-03  7:16   ` Jan Beulich
  2012-04-02 20:27 ` [PATCH 3 of 3] xend: Don't crash due to weird PCI devices Konrad Rzeszutek Wilk
  2 siblings, 1 reply; 7+ messages in thread
From: Konrad Rzeszutek Wilk @ 2012-04-02 20:27 UTC (permalink / raw)
  To: xen-devel, Ian.Jackson, stefano.stabellini, Ian.Campbell, jbeulich
  Cc: konrad.wilk

# HG changeset patch
# User Simon Graham <simon.graham@virtualcomputer.com>
# Date 1333398413 14400
# Node ID caefa03c38366c3e70d937bc95740c5d33c0892a
# Parent  f1da2ce71ed41d1b74ebe6916ff7710d6579438e
xen/pat: After suspend re-write PAT if BIOS changed it.

Certain AMD machines (this was a MSI or GigaBYTE BIOS) after resume
would reset the PAT MSR causing rather weird issues - where
the pages would (say they would be set to WC) would end up with the
wrong type (as they would use the BIOS PAT instead of the one set by
the hypervisor). And in some cases the PAT was stuck and needed
a couple of WRMSRL to actually take.

Signed-off-by: Simon Graham <simon.graham@virtualcomputer.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

diff -r f1da2ce71ed4 -r caefa03c3836 xen/arch/x86/acpi/power.c
--- a/xen/arch/x86/acpi/power.c	Mon Apr 02 16:26:48 2012 -0400
+++ b/xen/arch/x86/acpi/power.c	Mon Apr 02 16:26:53 2012 -0400
@@ -41,8 +41,27 @@ static DEFINE_SPINLOCK(pm_lock);
 
 struct acpi_sleep_info acpi_sinfo;
 
+static void pat_resume(void);
 void do_suspend_lowlevel(void);
 
+static void
+pat_resume()
+{
+    u64 pat;
+    if (!cpu_has_pat)
+        return;
+
+    rdmsrl(MSR_IA32_CR_PAT, pat);
+    if (pat != host_pat) {
+	printk(KERN_INFO PREFIX "Found PAT MSR: 0x%"PRIx64"\n", pat);
+	printk(KERN_INFO PREFIX "reseting to 0x%"PRIx64"\n", host_pat);
+	wrmsrl(MSR_IA32_CR_PAT, host_pat);
+	rdmsrl(MSR_IA32_CR_PAT, pat);
+	if (pat != host_pat)
+	    printk(KERN_WARNING PREFIX "PAT MSR stuck on: 0x%"PRIx64"\n", pat);
+    }
+}
+
 static int device_power_down(void)
 {
     console_suspend();
@@ -194,6 +213,7 @@ static int enter_state(u32 state)
     if ( cpu_has_efer )
         write_efer(read_efer());
 
+    pat_resume();
     device_power_up();
 
     mcheck_init(&boot_cpu_data, 0);

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

* [PATCH 3 of 3] xend: Don't crash due to weird PCI devices
  2012-04-02 20:27 [PATCH 0 of 3] Patches for Xen 4.2 (v2) Konrad Rzeszutek Wilk
  2012-04-02 20:27 ` [PATCH 1 of 3] xen/vga: Add 'vga_delay' parameter to delay screen output by X miliseconds per line Konrad Rzeszutek Wilk
  2012-04-02 20:27 ` [PATCH 2 of 3] xen/pat: After suspend re-write PAT if BIOS changed it Konrad Rzeszutek Wilk
@ 2012-04-02 20:27 ` Konrad Rzeszutek Wilk
  2 siblings, 0 replies; 7+ messages in thread
From: Konrad Rzeszutek Wilk @ 2012-04-02 20:27 UTC (permalink / raw)
  To: xen-devel, Ian.Jackson, stefano.stabellini, Ian.Campbell, jbeulich
  Cc: konrad.wilk

# HG changeset patch
# User Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
# Date 1333398413 14400
# Node ID f789a3effeb6f876b9672e6e64bbd98857f59b61
# Parent  caefa03c38366c3e70d937bc95740c5d33c0892a
xend: Don't crash due to weird PCI devices

This fixes Red Hat BZ 767742 where a user had some truly
weird PCI devices:

$ lspci -vvv -xxx -s 0000:01:00.0
01:00.0 VGA compatible controller: nVidia Corporation GT218 [NVS 3100M] (rev
ff) (prog-if ff)
 !!! Unknown header type 7f
00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
10: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
20: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
30: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff

And xend would report:

ERROR (pci:1272) Caught 'Looped capability chain: 0000:01:00.0'

This fixes it.

Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>

diff -r caefa03c3836 -r f789a3effeb6 tools/python/xen/util/pci.py
--- a/tools/python/xen/util/pci.py	Mon Apr 02 16:26:53 2012 -0400
+++ b/tools/python/xen/util/pci.py	Mon Apr 02 16:26:53 2012 -0400
@@ -1268,7 +1268,12 @@ class PciDevice:
             pass
 
     def get_info_from_sysfs(self):
-        self.find_capability(0x11)
+        try:
+            self.find_capability(0x11)
+        except PciDeviceParseError, err:
+            log.error("Caught '%s'" % err)
+            return False
+
         sysfs_mnt = find_sysfs_mnt()
         if sysfs_mnt == None:
             return False

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

* Re: [PATCH 1 of 3] xen/vga: Add 'vga_delay' parameter to delay screen output by X miliseconds per line
  2012-04-02 20:27 ` [PATCH 1 of 3] xen/vga: Add 'vga_delay' parameter to delay screen output by X miliseconds per line Konrad Rzeszutek Wilk
@ 2012-04-03  7:14   ` Jan Beulich
  2012-04-03  8:07   ` Ian Campbell
  1 sibling, 0 replies; 7+ messages in thread
From: Jan Beulich @ 2012-04-03  7:14 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: xen-devel, Ian.Jackson, Ian.Campbell, stefano.stabellini

>>> On 02.04.12 at 22:27, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:
> # HG changeset patch
> # User Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> # Date 1333398408 14400
> # Node ID f1da2ce71ed41d1b74ebe6916ff7710d6579438e
> # Parent  1088c8557a46ab28e509bb9482e2a73a21590df8
> xen/vga: Add 'vga_delay' parameter to delay screen output by X miliseconds 
> per line.
> 
> This is useful if you find yourself on machine that has no serial console,
> nor any PCI, PCIe to put in a serial card. Nothing really fancy except it 
> allows
> to capture the screenshot of the screen using a camera.
> 
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> 
> diff -r 1088c8557a46 -r f1da2ce71ed4 xen/drivers/video/vga.c
> --- a/xen/drivers/video/vga.c	Fri Mar 30 21:05:54 2012 +0100
> +++ b/xen/drivers/video/vga.c	Mon Apr 02 16:26:48 2012 -0400
> @@ -10,7 +10,7 @@
>  #include <xen/mm.h>
>  #include <xen/vga.h>
>  #include <asm/io.h>
> -
> +#include <xen/delay.h>
>  /* Filled in by arch boot code. */
>  struct xen_vga_console_info vga_console_info;
>  
> @@ -49,6 +49,12 @@ void (*vga_puts)(const char *) = vga_noo
>  static char __initdata opt_vga[30] = "";
>  string_param("vga", opt_vga);
>  
> +/*
> + * 'vga_delay=miliseconds' which defines to delay to print a line
> + * to the screen. 2 is a a good value to get a good screen output.

Maybe add something like "If you need to use this, do so with care
as it might screw up time handling", since this will suppress the timer
softirq for arbitrary periods of time.

> + */
> +unsigned int __read_mostly vga_delay;

static.

> +integer_param("vga_delay", vga_delay);

Missing blank line.

>  /* VGA text-mode definitions. */
>  static unsigned int columns, lines;
>  #define ATTRIBUTE   7
> @@ -135,6 +141,9 @@ static void vga_text_puts(const char *s)
>                  ypos = lines - 1;
>                  memmove(video, video + 2 * columns, ypos * 2 * columns);
>                  memset(video + ypos * 2 * columns, 0, 2 * xpos);
> +                if (vga_delay)

I don't think a conditional is needed here.

Jan

> +                    mdelay(vga_delay);
> +
>              }
>              xpos = 0;
>          }

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

* Re: [PATCH 2 of 3] xen/pat: After suspend re-write PAT if BIOS changed it
  2012-04-02 20:27 ` [PATCH 2 of 3] xen/pat: After suspend re-write PAT if BIOS changed it Konrad Rzeszutek Wilk
@ 2012-04-03  7:16   ` Jan Beulich
  0 siblings, 0 replies; 7+ messages in thread
From: Jan Beulich @ 2012-04-03  7:16 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: simon.graham, xen-devel, Ian.Jackson, Ian.Campbell, stefano.stabellini

>>> On 02.04.12 at 22:27, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> wrote:
> # HG changeset patch
> # User Simon Graham <simon.graham@virtualcomputer.com>
> # Date 1333398413 14400
> # Node ID caefa03c38366c3e70d937bc95740c5d33c0892a
> # Parent  f1da2ce71ed41d1b74ebe6916ff7710d6579438e
> xen/pat: After suspend re-write PAT if BIOS changed it.
> 
> Certain AMD machines (this was a MSI or GigaBYTE BIOS) after resume
> would reset the PAT MSR causing rather weird issues - where
> the pages would (say they would be set to WC) would end up with the
> wrong type (as they would use the BIOS PAT instead of the one set by
> the hypervisor). And in some cases the PAT was stuck and needed
> a couple of WRMSRL to actually take.

But you still fail to explain why the existing PAT resume handling is
insufficient, and without understanding that we shouldn't be applying
a patch like this.

Jan

> Signed-off-by: Simon Graham <simon.graham@virtualcomputer.com>
> Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> 
> diff -r f1da2ce71ed4 -r caefa03c3836 xen/arch/x86/acpi/power.c
> --- a/xen/arch/x86/acpi/power.c	Mon Apr 02 16:26:48 2012 -0400
> +++ b/xen/arch/x86/acpi/power.c	Mon Apr 02 16:26:53 2012 -0400
> @@ -41,8 +41,27 @@ static DEFINE_SPINLOCK(pm_lock);
>  
>  struct acpi_sleep_info acpi_sinfo;
>  
> +static void pat_resume(void);
>  void do_suspend_lowlevel(void);
>  
> +static void
> +pat_resume()
> +{
> +    u64 pat;
> +    if (!cpu_has_pat)
> +        return;
> +
> +    rdmsrl(MSR_IA32_CR_PAT, pat);
> +    if (pat != host_pat) {
> +	printk(KERN_INFO PREFIX "Found PAT MSR: 0x%"PRIx64"\n", pat);
> +	printk(KERN_INFO PREFIX "reseting to 0x%"PRIx64"\n", host_pat);
> +	wrmsrl(MSR_IA32_CR_PAT, host_pat);
> +	rdmsrl(MSR_IA32_CR_PAT, pat);
> +	if (pat != host_pat)
> +	    printk(KERN_WARNING PREFIX "PAT MSR stuck on: 0x%"PRIx64"\n", pat);
> +    }
> +}
> +
>  static int device_power_down(void)
>  {
>      console_suspend();
> @@ -194,6 +213,7 @@ static int enter_state(u32 state)
>      if ( cpu_has_efer )
>          write_efer(read_efer());
>  
> +    pat_resume();
>      device_power_up();
>  
>      mcheck_init(&boot_cpu_data, 0);

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

* Re: [PATCH 1 of 3] xen/vga: Add 'vga_delay' parameter to delay screen output by X miliseconds per line
  2012-04-02 20:27 ` [PATCH 1 of 3] xen/vga: Add 'vga_delay' parameter to delay screen output by X miliseconds per line Konrad Rzeszutek Wilk
  2012-04-03  7:14   ` Jan Beulich
@ 2012-04-03  8:07   ` Ian Campbell
  1 sibling, 0 replies; 7+ messages in thread
From: Ian Campbell @ 2012-04-03  8:07 UTC (permalink / raw)
  To: Konrad Rzeszutek Wilk
  Cc: xen-devel, Ian Jackson, jbeulich, Stefano Stabellini

On Mon, 2012-04-02 at 21:27 +0100, Konrad Rzeszutek Wilk wrote:
> @@ -49,6 +49,12 @@ void (*vga_puts)(const char *) = vga_noo
>  static char __initdata opt_vga[30] = "";
>  string_param("vga", opt_vga);
>  
> +/*
> + * 'vga_delay=miliseconds' which defines to delay to print a line
> + * to the screen. 2 is a a good value to get a good screen output.
> + */
> +unsigned int __read_mostly vga_delay;
> +integer_param("vga_delay", vga_delay);

Please patch docs/misc/xen-command-line.markdown too.

Ian.

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

end of thread, other threads:[~2012-04-03  8:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-02 20:27 [PATCH 0 of 3] Patches for Xen 4.2 (v2) Konrad Rzeszutek Wilk
2012-04-02 20:27 ` [PATCH 1 of 3] xen/vga: Add 'vga_delay' parameter to delay screen output by X miliseconds per line Konrad Rzeszutek Wilk
2012-04-03  7:14   ` Jan Beulich
2012-04-03  8:07   ` Ian Campbell
2012-04-02 20:27 ` [PATCH 2 of 3] xen/pat: After suspend re-write PAT if BIOS changed it Konrad Rzeszutek Wilk
2012-04-03  7:16   ` Jan Beulich
2012-04-02 20:27 ` [PATCH 3 of 3] xend: Don't crash due to weird PCI devices Konrad Rzeszutek Wilk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.