From: Yinghai Lu <yinghai@kernel.org>
To: Ingo Molnar <mingo@kernel.org>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
Ulrich Drepper <drepper@gmail.com>,
jbarnes@virtuousgeek.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
lenb@kernel.org, x86@kernel.org, linux-pci@vger.kernel.org
Subject: Re: SNB PCI root information
Date: Wed, 20 Jun 2012 20:50:03 -0700 [thread overview]
Message-ID: <CAE9FiQWKxe9VYvrQy5h4RP2dS7YHHXu4icjC+KPipkRKbsZN1g@mail.gmail.com> (raw)
In-Reply-To: <CAE9FiQWUo3uffM4NCUORJXR1pdPaf0E1Sws1hwVNAibHg5_yjQ@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1125 bytes --]
On Wed, Jun 20, 2012 at 7:37 PM, Yinghai Lu <yinghai@kernel.org> wrote:
> On Wed, Jun 20, 2012 at 12:34 PM, Ingo Molnar <mingo@kernel.org> wrote:
>>> if the vendor provide _PXM, that _PXM should be right and be
>>> trusted.
>>>
>>> if the vendor does not provide _PXM, we can have command line
>>> to input it before user can get one updated BIOS from vendor.
>>
>> So how about an incorrect _PXM, or a slightly inefficient one?
>> Why shouldn't it be possible for the user to override it?
>
> Try to keep the code simple.
>
>>
>> I mean, if we create a parameter space that tweaks data then why
>> not make it complete and allow *all* firmware data to be
>> (optionally) modified, from the kernel boot line?
>
> that pxm/node for pci device should be consistent with srat table etc,
> so better solution is that BIOS keep them consistent.
>
> If BIOS provide _PXM for pci device, the _PXM should have more chance
> to be right.
>
> Anyway if you insist that it should cover that wrong case, let me
> check if it could be done simply.
please check -v3, and it will add 40 lines.
and -v2 is about 25 lines.
Thanks
Yinghai
[-- Attachment #2: busnum_node_v3.patch --]
[-- Type: application/octet-stream, Size: 3956 bytes --]
Subject: [PATCH] PCI, X86: busnum/node boot command line for pci dev node setting.
Some intel new sandybridge or newer two sockets system do support support numa
for pci devices. But BIOS does not provide _PXM under those root bus in DSDT.
Add boot command line, so user could have chance to input node info before
BIOS guys figure out to add _PXM.
Fold fix from Ulrich to use ";" instead of ",".
| The problem is the pci= parameter
| handling uses ',' to separate parameters and therefore the second PCI
| root information, separated by a comma, is interpreted as a new pci=
| parameter.
-v3: According to Bjorn and Ingo, change to use "user input first" policy
so it could cover wrong _PXM case.
Reported-by: Ulrich Drepper <drepper@gmail.com>
Signed-off-by: Yinghai Lu <yinghai@kernel.org>
---
Documentation/kernel-parameters.txt | 5 +++++
arch/x86/include/asm/pci_x86.h | 3 +++
arch/x86/pci/acpi.c | 22 +++++++++++++---------
arch/x86/pci/common.c | 28 ++++++++++++++++++++++++++++
4 files changed, 49 insertions(+), 9 deletions(-)
Index: linux-2.6/Documentation/kernel-parameters.txt
===================================================================
--- linux-2.6.orig/Documentation/kernel-parameters.txt
+++ linux-2.6/Documentation/kernel-parameters.txt
@@ -2195,6 +2195,11 @@ bytes respectively. Such letter suffixes
only look for one device below a PCIe downstream
port.
+ busnum_node= [X86] Set node for root bus.
+ Format:
+ <bus>:<node>[; ...]
+ Specifies node for bus, will override bios _PXM
+ or probed value from hostbridge.
pcie_aspm= [PCIE] Forcibly enable or disable PCIe Active State Power
Management.
off Disable ASPM.
Index: linux-2.6/arch/x86/pci/common.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/common.c
+++ linux-2.6/arch/x86/pci/common.c
@@ -494,6 +494,34 @@ int __init pcibios_init(void)
return 0;
}
+int get_user_busnum_node(int busnum)
+{
+ int bus, node, count;
+ char *p;
+
+ p = strstr(boot_command_line, "busnum_node=");
+ if (!p)
+ return -1;
+
+ p += 12; /* strlen("busnum_node=") */
+ while (*p) {
+ count = 0;
+ if (sscanf(p, "%x:%x%n", &bus, &node, &count) != 2) {
+ printk(KERN_ERR "PCI: Can't parse busnum_node input: %s\n",
+ p);
+ break;
+ }
+ if (bus == busnum)
+ return node;
+ p += count;
+ if (*p != ';')
+ break;
+ p++;
+ }
+
+ return -1;
+}
+
char * __devinit pcibios_setup(char *str)
{
if (!strcmp(str, "off")) {
Index: linux-2.6/arch/x86/include/asm/pci_x86.h
===================================================================
--- linux-2.6.orig/arch/x86/include/asm/pci_x86.h
+++ linux-2.6/arch/x86/include/asm/pci_x86.h
@@ -46,6 +46,9 @@ enum pci_bf_sort_state {
pci_dmi_bf,
};
+/* pci-common.c */
+int get_user_busnum_node(int busnum);
+
/* pci-i386.c */
void pcibios_resource_survey(void);
Index: linux-2.6/arch/x86/pci/acpi.c
===================================================================
--- linux-2.6.orig/arch/x86/pci/acpi.c
+++ linux-2.6/arch/x86/pci/acpi.c
@@ -433,7 +433,7 @@ struct pci_bus * __devinit pci_acpi_scan
struct pci_sysdata *sd;
int node;
#ifdef CONFIG_ACPI_NUMA
- int pxm;
+ int pxm = -1;
#endif
if (domain && !pci_domains_supported) {
@@ -443,16 +443,20 @@ struct pci_bus * __devinit pci_acpi_scan
return NULL;
}
- node = -1;
+ node = get_user_busnum_node(busnum);
+ if (node == -1) {
#ifdef CONFIG_ACPI_NUMA
- pxm = acpi_get_pxm(device->handle);
- if (pxm >= 0)
- node = pxm_to_node(pxm);
- if (node != -1)
- set_mp_bus_to_node(busnum, node);
- else
-#endif
+ pxm = acpi_get_pxm(device->handle);
+ if (pxm >= 0)
+ node = pxm_to_node(pxm);
+ if (node != -1)
+ set_mp_bus_to_node(busnum, node);
+ else
+ node = get_mp_bus_to_node(busnum);
+#else
node = get_mp_bus_to_node(busnum);
+#endif
+ }
if (node != -1 && !node_online(node))
node = -1;
next prev parent reply other threads:[~2012-06-21 3:50 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CAOPLpQfUm-2ENkbnYfXEn1nf9FHnaRk3aqQTSTBWb-CsfCUCFA@mail.gmail.com>
2012-06-16 3:03 ` SNB PCI root information Yinghai Lu
2012-06-16 8:52 ` Thomas Gleixner
2012-06-16 19:36 ` Yinghai Lu
2012-06-16 21:56 ` Bjorn Helgaas
2012-06-18 22:30 ` Ulrich Drepper
2012-06-18 23:40 ` Yinghai Lu
2012-06-19 12:36 ` Bjorn Helgaas
2012-06-19 18:20 ` Yinghai Lu
2012-06-20 17:11 ` Ulrich Drepper
2012-06-20 17:17 ` Bjorn Helgaas
2012-06-20 17:59 ` Ulrich Drepper
2012-06-20 18:37 ` Yinghai Lu
2012-06-20 18:46 ` Bjorn Helgaas
2012-06-20 19:28 ` Yinghai Lu
2012-06-20 19:34 ` Ingo Molnar
2012-06-20 20:04 ` Ulrich Drepper
2012-06-20 20:16 ` Bjorn Helgaas
2012-06-20 21:21 ` Ulrich Drepper
2012-06-20 23:58 ` Yinghai Lu
2012-06-21 2:37 ` Yinghai Lu
2012-06-21 3:50 ` Yinghai Lu [this message]
2012-06-21 12:17 ` Ulrich Drepper
2012-06-21 16:22 ` Ulrich Drepper
2012-06-21 18:11 ` Yinghai Lu
2012-06-25 17:54 ` Ulrich Drepper
2012-06-20 19:57 ` Brice Goglin
2012-06-21 2:43 ` Yinghai Lu
2012-06-21 5:56 ` Brice Goglin
2012-06-21 19:24 ` Yinghai Lu
2012-06-22 7:14 ` Brice Goglin
2012-06-22 17:28 ` Yinghai Lu
2012-06-22 20:38 ` Brice Goglin
2012-06-22 20:41 ` Yinghai Lu
2012-06-25 9:07 ` Brice Goglin
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=CAE9FiQWKxe9VYvrQy5h4RP2dS7YHHXu4icjC+KPipkRKbsZN1g@mail.gmail.com \
--to=yinghai@kernel.org \
--cc=bhelgaas@google.com \
--cc=drepper@gmail.com \
--cc=jbarnes@virtuousgeek.org \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=x86@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).