WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] Re: [PATCH] to fix ACPI slit table access at runtime

To: "Kamble, Nitin A" <nitin.a.kamble@xxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxxxx>
Subject: [Xen-devel] Re: [PATCH] to fix ACPI slit table access at runtime
From: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>
Date: Thu, 25 Feb 2010 12:13:10 +0000
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Thu, 25 Feb 2010 04:14:32 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <8EA2C2C4116BF44AB370468FBF85A7770124F1698B@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Acq1rmsyjyldpDGeT+ivAyknVofFzQAZXoLf
Thread-topic: [PATCH] to fix ACPI slit table access at runtime
User-agent: Microsoft-Entourage/12.23.0.091001
On 25/02/2010 00:06, "Kamble, Nitin A" <nitin.a.kamble@xxxxxxxxx> wrote:

> Hi Keir,
>   I was noticing that the current Xen code was not able to access the ACPI
> SLIT data (node to node distance) at runtime. And I found root cause of it
> being the acpi_slit pointer not being valid at runtime.
> I have fixed the issue by saving the slit table data at boot time, and using
> the saved data for runtime access as follows.

Better would be to dynamically alloc_boot_pages(). Then also the patch would
be about two or three lines. The only disadvantage would be that then SLIT
parsing would be for 64-bit hypervisor only (since 32-bit Xen does not have
mappings for bootmem). I think we can live with that - I note that Linux
only does SLIT parsing for x86_64 too.

By the way, a separate question for Jan: I notice you added an
alloc_boot_pages() call in arch/x86/numa.c, and get a virtual address from
mfn_to_virt(). This is bogus for x86_32, so can we just stub out that
function for the 32-bit build: looks like the caller would then gracefully
fail? I wonder whether this could explain the crash that Ian Jackson
reported on one system with PAE Xen the other day.

 -- Keir

> Please accept or comment.
> Thanks & Regards,
> Nitin
>  
> Signed-Off-By: Nitin A Kamble <nitin.a.kamble@xxxxxxxxx>
>  
> diff -r b474725a242b xen/arch/x86/srat.c
> --- a/xen/arch/x86/srat.c             Thu Feb 25 07:50:38 2010 -0800
> +++ b/xen/arch/x86/srat.c          Thu Feb 25 08:02:36 2010 -0800
> @@ -20,13 +20,15 @@
>  #include <asm/e820.h>
>  #include <asm/page.h>
>  
> -static struct acpi_table_slit *__read_mostly acpi_slit;
> -
>  static nodemask_t nodes_parsed __initdata;
>  static nodemask_t nodes_found __initdata;
>  static struct node nodes[MAX_NUMNODES] __initdata;
>  static u8 __read_mostly pxm2node[256] = { [0 ... 255] = 0xff };
>  
> +static struct {
> +             struct acpi_table_slit slit_table;
> +             u8 entries[MAX_NUMNODES * MAX_NUMNODES];
> +} acpi_slit;
>  
>  static int num_node_memblks;
>  static struct node node_memblk_range[NR_NODE_MEMBLKS];
> @@ -144,7 +146,8 @@
>                                 printk(KERN_INFO "ACPI: SLIT table looks
> invalid. Not used.\n");
>                                 return;
>                 }
> -              acpi_slit = slit;
> +
> +             memcpy(&acpi_slit, slit, slit->header.length);
>  }
>  
>  /* Callback for Proximity Domain -> LAPIC mapping */
> @@ -424,10 +427,10 @@
>  {
>                 int index;
>  
> -              if (!acpi_slit)
> +             if (!acpi_slit.slit_table.header.length)
>                                 return a == b ? 10 : 20;
> -              index = acpi_slit->locality_count * node_to_pxm(a);
> -              return acpi_slit->entry[index + node_to_pxm(b)];
> +             index = acpi_slit.slit_table.locality_count * node_to_pxm(a);
> +             return acpi_slit.slit_table.entry[index + node_to_pxm(b)];
>  }
>  
>  EXPORT_SYMBOL(__node_distance);
> diff -r b474725a242b xen/include/acpi/actbl1.h
> --- a/xen/include/acpi/actbl1.h Thu Feb 25 07:50:38 2010 -0800
> +++ b/xen/include/acpi/actbl1.h              Thu Feb 25 08:02:36 2010 -0800
> @@ -573,7 +573,7 @@
>  struct acpi_table_slit {
>                 struct acpi_table_header header;            /* Common ACPI
> table header */
>                 u64 locality_count;
> -              u8 entry[1];                        /* Real size = localities^2
> */
> +             u8 entry[0];                        /* Real size = localities^2
> */
>  };
>  
>  
> /*****************************************************************************
> **
> 



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel