LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* Panic on ppc64 with numa_balancing and !sparsemem_vmemmap
From: Srikar Dronamraju @ 2014-02-19 18:02 UTC (permalink / raw)
  To: Aneesh Kumar, riel, mgorman
  Cc: Peter Zijlstra, paulus, linuxppc-dev, linux-mm


On a powerpc machine with CONFIG_NUMA_BALANCING=y and CONFIG_SPARSEMEM_VMEMMAP
not enabled,  kernel panics.

This is true of kernel versions 3.13 to the latest commit 960dfc4 which is
3.14-rc3+.  i.e the recent 3 fixups from Aneesh doesnt seem to help this case.

Sometimes it fails on boot up itself. Otherwise a kernel compile is good enough
to trigger the same. I am seeing this on a Power 7 box.

Kernel 3.14.0-rc3-mainline_v313-00168-g960dfc4 on an ppc64

transam2s-lp1 login: qla2xxx [0003:01:00.1]-8038:2: Cable is unplugged...
Unable to handle kernel paging request for data at address 0x00000457
Faulting instruction address: 0xc0000000000d6004
cpu 0x38: Vector: 300 (Data Access) at [c00000171561f700]
    pc: c0000000000d6004: .task_numa_fault+0x604/0xa30
    lr: c0000000000d62fc: .task_numa_fault+0x8fc/0xa30
    sp: c00000171561f980
   msr: 8000000000009032
   dar: 457
 dsisr: 40000000
  current = 0xc0000017155d9b00
  paca    = 0xc00000000ec1e000   softe: 0        irq_happened: 0x00
    pid   = 16898, comm = gzip
enter ? for help
[c00000171561fa70] c0000000001b0fb0 .do_numa_page+0x1b0/0x2a0
[c00000171561fb20] c0000000001b2788 .handle_mm_fault+0x538/0xca0
[c00000171561fc00] c00000000082f498 .do_page_fault+0x378/0x880
[c00000171561fe30] c000000000009568 handle_page_fault+0x10/0x30
--- Exception: 301 (Data Access) at 00000000100031d8
SP (3fffd45ea2d0) is in userspace
38:mon>


(gdb) list *(task_numa_fault+0x604)
0xc0000000000d6004 is in task_numa_fault (/home/srikar/work/linux.git/include/linux/mm.h:753).
748             return cpupid_to_cpu(cpupid) == (-1 & LAST__CPU_MASK);
749     }
750
751     static inline bool __cpupid_match_pid(pid_t task_pid, int cpupid)
752     {
753             return (task_pid & LAST__PID_MASK) == cpupid_to_pid(cpupid);
754     }
755
756     #define cpupid_match_pid(task, cpupid) __cpupid_match_pid(task->pid, cpupid)
757     #ifdef LAST_CPUPID_NOT_IN_PAGE_FLAGS
(gdb) 


However this doesnt seem to happen if we have CONFIG_SPARSEMEM_VMEMMAP=y set in the config.


-- 
Thanks nnn Regards
Srikar Dronamraju

^ permalink raw reply

* Re: [PATCH] of: give priority to the compatible match in __of_match_node()
From: Paul Gortmaker @ 2014-02-19 18:25 UTC (permalink / raw)
  To: Rob Herring
  Cc: devicetree@vger.kernel.org, Kevin Hao, Arnd Bergmann,
	Chris Proctor, Stephen N Chivers, Scott Wood, Rob Herring,
	Grant Likely, linuxppc-dev, Sebastian Hesselbarth
In-Reply-To: <CAL_JsqKMi2H=vwoxrOt8QRA2xJeiLqBKKfLtt4QRCRoFk6JUHg@mail.gmail.com>

On Thu, Feb 13, 2014 at 2:01 PM, Rob Herring <robherring2@gmail.com> wrote:
> On Wed, Feb 12, 2014 at 5:38 AM, Kevin Hao <haokexin@gmail.com> wrote:
>> When the device node do have a compatible property, we definitely
>> prefer the compatible match besides the type and name. Only if
>> there is no such a match, we then consider the candidate which
>> doesn't have compatible entry but do match the type or name with
>> the device node.
>>
>> This is based on a patch from Sebastian Hesselbarth.
>>   http://patchwork.ozlabs.org/patch/319434/
>>
>> I did some code refactoring and also fixed a bug in the original patch.
>
> I'm inclined to just revert this once again and avoid possibly
> breaking yet another platform.

Well, for what it is worth, today's (Feb19th) linux-next tree fails to boot
on my sbc8548.   It fails with:
-----------------------------------------------
libphy: Freescale PowerQUICC MII Bus: probed
mdio_bus ethernet@e002400: /soc8548@e0000000/ethernet@24000/mdio@520
PHY address 1312 is too large
libphy: Freescale PowerQUICC MII Bus: probed
libphy: Freescale PowerQUICC MII Bus: probed
mdio_bus ethernet@e002500: /soc8548@e0000000/ethernet@25000/mdio@520
PHY address 1312 is too large
libphy: Freescale PowerQUICC MII Bus: probed
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
<fail nfs mount>
-----------------------------------------------

On a normal boot, we should see this:
-----------------------------------------------
libphy: Freescale PowerQUICC MII Bus: probed
libphy: Freescale PowerQUICC MII Bus: probed
fsl-gianfar e0024000.ethernet: enabled errata workarounds, flags: 0x4
fsl-gianfar e0024000.ethernet eth0: mac: 02:e0:0c:00:05:fd
fsl-gianfar e0024000.ethernet eth0: Running with NAPI enabled
fsl-gianfar e0024000.ethernet eth0: RX BD ring size for Q[0]: 256
fsl-gianfar e0024000.ethernet eth0: TX BD ring size for Q[0]: 256
fsl-gianfar e0025000.ethernet: enabled errata workarounds, flags: 0x4
fsl-gianfar e0025000.ethernet eth1: mac: 02:e0:0c:00:06:fd
fsl-gianfar e0025000.ethernet eth1: Running with NAPI enabled
fsl-gianfar e0025000.ethernet eth1: RX BD ring size for Q[0]: 256
fsl-gianfar e0025000.ethernet eth1: TX BD ring size for Q[0]: 256
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17
-----------------------------------------------


Git bisect says:

ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4 is the first bad commit
commit ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4
Author: Kevin Hao <haokexin@gmail.com>
Date:   Tue Feb 18 15:57:30 2014 +0800

    of: reimplement the matching method for __of_match_node()

    In the current implementation of __of_match_node(), it will compare
    each given match entry against all the node's compatible strings
    with of_device_is_compatible().

    To achieve multiple compatible strings per node with ordering from
    specific to generic, this requires given matches to be ordered from
    specific to generic. For most of the drivers this is not true and
    also an alphabetical ordering is more sane there.

    Therefore, we define a following priority order for the match, and
    then scan all the entries to find the best match.
      1. specific compatible && type && name
      2. specific compatible && type
      3. specific compatible && name
      4. specific compatible
      5. general compatible && type && name
      6. general compatible && type
      7. general compatible && name
      8. general compatible
      9. type && name
      10. type
      11. name

    This is based on some pseudo-codes provided by Grant Likely.

    Signed-off-by: Kevin Hao <haokexin@gmail.com>
    [grant.likely: Changed multiplier to 4 which makes more sense]
    Signed-off-by: Grant Likely <grant.likely@linaro.org>

:040000 040000 8f5dd19174417aece63b308ff299a5dbe2efa5a0
8401b0e3903e23e973845ee75b26b04345d803d2 M      drivers

As a double check, I checked out the head of linux-next, and did a
revert of the above commit, and my sbc8548 can then boot properly.

Not doing anything fancy ; using the defconfig exactly as-is, and
ensuring the dtb is fresh from linux-next HEAD of today.

Thanks,
Paul.
--

>
> However, I think I would like to see this structured differently. We
> basically have 2 ways of matching: the existing pre-3.14 way and the
> desired match on best compatible only. All new bindings should match
> with the new way and the old way needs to be kept for compatibility.
> So lets structure the code that way. Search the match table first for
> best compatible with name and type NULL, then search the table the old
> way. I realize it appears you are doing this, but it is not clear this
> is the intent of the code. I would like to see this written as a patch
> with commit 105353145eafb3ea919 reverted first and you add a new match
> function to call first and then fallback to the existing function.
>
> Rob
>
>>
>> Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
>> Signed-off-by: Kevin Hao <haokexin@gmail.com>
>> ---
>>  drivers/of/base.c | 55 +++++++++++++++++++++++++++++++++++++------------------
>>  1 file changed, 37 insertions(+), 18 deletions(-)
>>
>> diff --git a/drivers/of/base.c b/drivers/of/base.c
>> index ff85450d5683..9d655df458bd 100644
>> --- a/drivers/of/base.c
>> +++ b/drivers/of/base.c
>> @@ -730,32 +730,45 @@ out:
>>  }
>>  EXPORT_SYMBOL(of_find_node_with_property);
>>
>> +static int of_match_type_or_name(const struct device_node *node,
>> +                               const struct of_device_id *m)
>> +{
>> +       int match = 1;
>> +
>> +       if (m->name[0])
>> +               match &= node->name && !strcmp(m->name, node->name);
>> +
>> +       if (m->type[0])
>> +               match &= node->type && !strcmp(m->type, node->type);
>> +
>> +       return match;
>> +}
>> +
>>  static
>>  const struct of_device_id *__of_match_node(const struct of_device_id *matches,
>>                                            const struct device_node *node)
>>  {
>>         const char *cp;
>>         int cplen, l;
>> +       const struct of_device_id *m;
>> +       int match;
>>
>>         if (!matches)
>>                 return NULL;
>>
>>         cp = __of_get_property(node, "compatible", &cplen);
>> -       do {
>> -               const struct of_device_id *m = matches;
>> +       while (cp && (cplen > 0)) {
>> +               m = matches;
>>
>>                 /* Check against matches with current compatible string */
>>                 while (m->name[0] || m->type[0] || m->compatible[0]) {
>> -                       int match = 1;
>> -                       if (m->name[0])
>> -                               match &= node->name
>> -                                       && !strcmp(m->name, node->name);
>> -                       if (m->type[0])
>> -                               match &= node->type
>> -                                       && !strcmp(m->type, node->type);
>> -                       if (m->compatible[0])
>> -                               match &= cp
>> -                                       && !of_compat_cmp(m->compatible, cp,
>> +                       if (!m->compatible[0]) {
>> +                               m++;
>> +                               continue;
>> +                       }
>> +
>> +                       match = of_match_type_or_name(node, m);
>> +                       match &= cp && !of_compat_cmp(m->compatible, cp,
>>                                                         strlen(m->compatible));
>>                         if (match)
>>                                 return m;
>> @@ -763,12 +776,18 @@ const struct of_device_id *__of_match_node(const struct of_device_id *matches,
>>                 }
>>
>>                 /* Get node's next compatible string */
>> -               if (cp) {
>> -                       l = strlen(cp) + 1;
>> -                       cp += l;
>> -                       cplen -= l;
>> -               }
>> -       } while (cp && (cplen > 0));
>> +               l = strlen(cp) + 1;
>> +               cp += l;
>> +               cplen -= l;
>> +       }
>> +
>> +       m = matches;
>> +       /* Check against matches without compatible string */
>> +       while (m->name[0] || m->type[0] || m->compatible[0]) {
>> +               if (!m->compatible[0] && of_match_type_or_name(node, m))
>> +                       return m;
>> +               m++;
>> +       }
>>
>>         return NULL;
>>  }
>> --
>> 1.8.5.3
>>
>> --
>> To unsubscribe from this list: send the line "unsubscribe devicetree" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply

* Re: Anyone using SysRQ key sequences on console serial port ?
From: Paul Gortmaker @ 2014-02-19 18:42 UTC (permalink / raw)
  To: John Donnelly, Scott Wood; +Cc: linuxppc-dev
In-Reply-To: <CAGtOQbQXLpdzAzxgwtzisEJ1MAeND8057103oUO-v9x4Ki8qYQ@mail.gmail.com>

[BTW, your html mail may be ignored by most people ; for example most of
 the linux lists on vger.kernel.org actively reject it; top posting isn't
 going to help either... ]

On 14-02-18 02:47 PM, John Donnelly wrote:
> I am enable to get one keyboard sequence responded to with the noted change
> in the dts .
> 
>  for instance:
> 
>    SysRQ ( Break)   c
> 
>   Panics .. Which is a good response, and since it doesn't require a return
> to user mode ( I suspect )  it appears to work.
> 
> Any other requests fail to report any information :
> 
>  SysRQ (break )  l - list active processes
>                          m - list memory
> 
>   Any additional SysRQ are ignored., and the system appears hung.

It must be something specific about your particular platform, or the
custom patches you have applied then.  I just tested today's linux-next
tree (i.e. the latest bleeding edge stuff) and it still works for the
sbc8548 (defconfig + enable magic SYSRQ option).  I did "s" (sync) multiple
times and "?" then "m" for memory dump (obviously those chars don't get
echo'd to the console....

 ---------------------------------------
root@sbc8548:~# cat /proc/cpuinfo |grep cpu
cpu             : e500v2
root@sbc8548:~# SysRq : Emergency Sync
Emergency Sync complete
SysRq : Emergency Sync
Emergency Sync complete
SysRq : HELP : loglevel(0-9) reboot(b) crash(c) terminate-all-tasks(e) memory-full-oom-kill(f) kill-all-tasks(i) thaw-filesystems(j) show-memory-usage(m) nice-all-RT-tasks(n) poweroff(o) show-registers(p) show-all-timers(q) sync(s) show-task-states(t) unmount(u) show-blocked-tasks(w)
SysRq : Show Memory
Mem-Info:
DMA per-cpu:
CPU    0: hi:  186, btch:  31 usd: 132
active_anon:738 inactive_anon:29 isolated_anon:0
 active_file:915 inactive_file:2219 isolated_file:0
 unevictable:0 dirty:0 writeback:0 unstable:0
 free:188325 slab_reclaimable:488 slab_unreclaimable:778
 mapped:1006 shmem:44 pagetables:83 bounce:0
 free_cma:0
DMA free:753300kB min:3520kB low:4400kB high:5280kB active_anon:2952kB inactive_anon:116kB active_file:3660kB inactive_file:8876kB unevictable:0kB isolated(anon):0kB isolated(file):0kB 
present:786432kB managed:775916kB mlocked:0kB dirty:0kB writeback:0kB mapped:4024kB shmem:176kB slab_reclaimable:1952kB slab_unreclaimable:3112kB kernel_stack:264kB pagetables:332kB uns
table:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? no
lowmem_reserve[]: 0 0 0
DMA: 403*4kB (UEM) 271*8kB (UEM) 131*16kB (UM) 35*32kB (UM) 15*64kB (UEM) 1*128kB (M) 1*256kB (M) 1*512kB (U) 1*1024kB (U) 3*2048kB (UEM) 180*4096kB (MR) = 753300kB
3178 total pagecache pages
0 pages in swap cache
Swap cache stats: add 0, delete 0, find 0/0
Free swap  = 0kB
Total swap = 0kB
196608 pages RAM
0 pages HighMem/MovableOnly
2629 pages reserved
 ---------------------------------------


Paul.
--

> 
>  On an reference Intel platform, multiple SyqRQ can be issued and the
> system remains healthy .
> 
> 
> 
> 
> 
> 
> 
> 
> 
> On Mon, Feb 17, 2014 at 1:37 PM, Scott Wood <scottwood@freescale.com> wrote:
> 
>> On Sun, 2014-02-16 at 10:56 -0500, Paul Gortmaker wrote:
>>> On Fri, Feb 14, 2014 at 3:42 PM, John Donnelly <john.d@servergy.com>
>> wrote:
>>>> Hi,
>>>>
>>>>  I tried using the SysRq hotkey sequence on a serial console -
>>>> 3.11.0-5-powerpc-e500mc system, by issuing a " break " and the system
>>>> immediately wedges after displaying "SysRQ : HELP : " using both
>> "Putty" and
>>>> "Teraterm"  terminal emulators. I know the system is dead because my
>> ssh
>>>> sessions stopped too.
>>>
>>> Yes it does work -- or at least it _did_ work.  Make sure your dts has
>> an entry
>>>
>>>                         compatible = "fsl,ns16550", "ns16550";
>>>
>>> since that enables a workaround I'd added for a hardware errata relating
>>> to sending breaks over the serial console.   What you describe above
>>> makes me think you aren't getting the workaround enabled.
>>
>> Also make sure CONFIG_SERIAL_8250_FSL is enabled.
>>
>> -Scott
>>
>>
>>
> 
> 

^ permalink raw reply

* Re: [PATCH] of: give priority to the compatible match in __of_match_node()
From: Scott Wood @ 2014-02-19 18:57 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: Chris Proctor, Kevin Hao, Arnd Bergmann,
	devicetree@vger.kernel.org, Stephen N Chivers, Rob Herring,
	Rob Herring, Grant Likely, linuxppc-dev, Sebastian Hesselbarth
In-Reply-To: <CAP=VYLr7hqnzW2HLS4GCMFeghCgPmrQZHYst+AUfZc_WNT-Wog@mail.gmail.com>

On Wed, 2014-02-19 at 13:25 -0500, Paul Gortmaker wrote:
> On Thu, Feb 13, 2014 at 2:01 PM, Rob Herring <robherring2@gmail.com> wrote:
> > On Wed, Feb 12, 2014 at 5:38 AM, Kevin Hao <haokexin@gmail.com> wrote:
> >> When the device node do have a compatible property, we definitely
> >> prefer the compatible match besides the type and name. Only if
> >> there is no such a match, we then consider the candidate which
> >> doesn't have compatible entry but do match the type or name with
> >> the device node.
> >>
> >> This is based on a patch from Sebastian Hesselbarth.
> >>   http://patchwork.ozlabs.org/patch/319434/
> >>
> >> I did some code refactoring and also fixed a bug in the original patch.
> >
> > I'm inclined to just revert this once again and avoid possibly
> > breaking yet another platform.
> 
> Well, for what it is worth, today's (Feb19th) linux-next tree fails to boot
> on my sbc8548.   It fails with:
> -----------------------------------------------
> libphy: Freescale PowerQUICC MII Bus: probed
> mdio_bus ethernet@e002400: /soc8548@e0000000/ethernet@24000/mdio@520
> PHY address 1312 is too large
> libphy: Freescale PowerQUICC MII Bus: probed
> libphy: Freescale PowerQUICC MII Bus: probed
> mdio_bus ethernet@e002500: /soc8548@e0000000/ethernet@25000/mdio@520
> PHY address 1312 is too large
> libphy: Freescale PowerQUICC MII Bus: probed
> TCP: cubic registered
> Initializing XFRM netlink socket
> NET: Registered protocol family 17
> <fail nfs mount>
> -----------------------------------------------
> 
> On a normal boot, we should see this:
> -----------------------------------------------
> libphy: Freescale PowerQUICC MII Bus: probed
> libphy: Freescale PowerQUICC MII Bus: probed
> fsl-gianfar e0024000.ethernet: enabled errata workarounds, flags: 0x4
> fsl-gianfar e0024000.ethernet eth0: mac: 02:e0:0c:00:05:fd
> fsl-gianfar e0024000.ethernet eth0: Running with NAPI enabled
> fsl-gianfar e0024000.ethernet eth0: RX BD ring size for Q[0]: 256
> fsl-gianfar e0024000.ethernet eth0: TX BD ring size for Q[0]: 256
> fsl-gianfar e0025000.ethernet: enabled errata workarounds, flags: 0x4
> fsl-gianfar e0025000.ethernet eth1: mac: 02:e0:0c:00:06:fd
> fsl-gianfar e0025000.ethernet eth1: Running with NAPI enabled
> fsl-gianfar e0025000.ethernet eth1: RX BD ring size for Q[0]: 256
> fsl-gianfar e0025000.ethernet eth1: TX BD ring size for Q[0]: 256
> TCP: cubic registered
> Initializing XFRM netlink socket
> NET: Registered protocol family 17
> -----------------------------------------------
> 
> 
> Git bisect says:
> 
> ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4 is the first bad commit
> commit ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4
> Author: Kevin Hao <haokexin@gmail.com>
> Date:   Tue Feb 18 15:57:30 2014 +0800
> 
>     of: reimplement the matching method for __of_match_node()
> 
>     In the current implementation of __of_match_node(), it will compare
>     each given match entry against all the node's compatible strings
>     with of_device_is_compatible().
> 
>     To achieve multiple compatible strings per node with ordering from
>     specific to generic, this requires given matches to be ordered from
>     specific to generic. For most of the drivers this is not true and
>     also an alphabetical ordering is more sane there.
> 
>     Therefore, we define a following priority order for the match, and
>     then scan all the entries to find the best match.
>       1. specific compatible && type && name
>       2. specific compatible && type
>       3. specific compatible && name
>       4. specific compatible
>       5. general compatible && type && name
>       6. general compatible && type
>       7. general compatible && name
>       8. general compatible
>       9. type && name
>       10. type
>       11. name
> 
>     This is based on some pseudo-codes provided by Grant Likely.
> 
>     Signed-off-by: Kevin Hao <haokexin@gmail.com>
>     [grant.likely: Changed multiplier to 4 which makes more sense]
>     Signed-off-by: Grant Likely <grant.likely@linaro.org>
> 
> :040000 040000 8f5dd19174417aece63b308ff299a5dbe2efa5a0
> 8401b0e3903e23e973845ee75b26b04345d803d2 M      drivers
> 
> As a double check, I checked out the head of linux-next, and did a
> revert of the above commit, and my sbc8548 can then boot properly.
> 
> Not doing anything fancy ; using the defconfig exactly as-is, and
> ensuring the dtb is fresh from linux-next HEAD of today.

It looks like the new matching function doesn't check the validity of
the entire match (i.e. everything specified must match the node) before
scoring it.

The ethernet driver has this match (among others):
        {
                .type = "network",
                .compatible = "gianfar",
        },

...while the mdio driver has this match (among others):

        {
                .type = "mdio",
                .compatible = "gianfar", 
                .data = &(struct fsl_pq_mdio_data) {
                        .mii_offset = offsetof(struct fsl_pq_mdio, mii),
                        .get_tbipa = get_gfar_tbipa,
                },
        },

(Yes, it's an awful device tree binding.)

It seems that the ethernet device is being bound to the mdio driver due
to the compatible match, even though type differs.

You could also end up with a .type and/or .name based match,
despite .compatible being present an a mismatch.

-Scott

^ permalink raw reply

* Re: [PATCH] of: give priority to the compatible match in __of_match_node()
From: Grant Likely @ 2014-02-19 20:41 UTC (permalink / raw)
  To: Paul Gortmaker, Rob Herring
  Cc: devicetree@vger.kernel.org, Kevin Hao, Arnd Bergmann,
	Chris Proctor, Stephen N Chivers, Rob Herring, Scott Wood,
	linuxppc-dev, Sebastian Hesselbarth
In-Reply-To: <CAP=VYLr7hqnzW2HLS4GCMFeghCgPmrQZHYst+AUfZc_WNT-Wog@mail.gmail.com>

On Wed, 19 Feb 2014 13:25:54 -0500, Paul Gortmaker <paul.gortmaker@windriver.com> wrote:
> On Thu, Feb 13, 2014 at 2:01 PM, Rob Herring <robherring2@gmail.com> wrote:
> > On Wed, Feb 12, 2014 at 5:38 AM, Kevin Hao <haokexin@gmail.com> wrote:
> >> When the device node do have a compatible property, we definitely
> >> prefer the compatible match besides the type and name. Only if
> >> there is no such a match, we then consider the candidate which
> >> doesn't have compatible entry but do match the type or name with
> >> the device node.
> >>
> >> This is based on a patch from Sebastian Hesselbarth.
> >>   http://patchwork.ozlabs.org/patch/319434/
> >>
> >> I did some code refactoring and also fixed a bug in the original patch.
> >
> > I'm inclined to just revert this once again and avoid possibly
> > breaking yet another platform.
> 
> Well, for what it is worth, today's (Feb19th) linux-next tree fails to boot
> on my sbc8548.   It fails with:

I think I've got it fixed now with the latest series. Please try the
devicetree/merge branch on git://git.secretlab.ca/git/linux

g.

> -----------------------------------------------
> libphy: Freescale PowerQUICC MII Bus: probed
> mdio_bus ethernet@e002400: /soc8548@e0000000/ethernet@24000/mdio@520
> PHY address 1312 is too large
> libphy: Freescale PowerQUICC MII Bus: probed
> libphy: Freescale PowerQUICC MII Bus: probed
> mdio_bus ethernet@e002500: /soc8548@e0000000/ethernet@25000/mdio@520
> PHY address 1312 is too large
> libphy: Freescale PowerQUICC MII Bus: probed
> TCP: cubic registered
> Initializing XFRM netlink socket
> NET: Registered protocol family 17
> <fail nfs mount>
> -----------------------------------------------
> 
> On a normal boot, we should see this:
> -----------------------------------------------
> libphy: Freescale PowerQUICC MII Bus: probed
> libphy: Freescale PowerQUICC MII Bus: probed
> fsl-gianfar e0024000.ethernet: enabled errata workarounds, flags: 0x4
> fsl-gianfar e0024000.ethernet eth0: mac: 02:e0:0c:00:05:fd
> fsl-gianfar e0024000.ethernet eth0: Running with NAPI enabled
> fsl-gianfar e0024000.ethernet eth0: RX BD ring size for Q[0]: 256
> fsl-gianfar e0024000.ethernet eth0: TX BD ring size for Q[0]: 256
> fsl-gianfar e0025000.ethernet: enabled errata workarounds, flags: 0x4
> fsl-gianfar e0025000.ethernet eth1: mac: 02:e0:0c:00:06:fd
> fsl-gianfar e0025000.ethernet eth1: Running with NAPI enabled
> fsl-gianfar e0025000.ethernet eth1: RX BD ring size for Q[0]: 256
> fsl-gianfar e0025000.ethernet eth1: TX BD ring size for Q[0]: 256
> TCP: cubic registered
> Initializing XFRM netlink socket
> NET: Registered protocol family 17
> -----------------------------------------------
> 
> 
> Git bisect says:
> 
> ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4 is the first bad commit
> commit ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4
> Author: Kevin Hao <haokexin@gmail.com>
> Date:   Tue Feb 18 15:57:30 2014 +0800
> 
>     of: reimplement the matching method for __of_match_node()
> 
>     In the current implementation of __of_match_node(), it will compare
>     each given match entry against all the node's compatible strings
>     with of_device_is_compatible().
> 
>     To achieve multiple compatible strings per node with ordering from
>     specific to generic, this requires given matches to be ordered from
>     specific to generic. For most of the drivers this is not true and
>     also an alphabetical ordering is more sane there.
> 
>     Therefore, we define a following priority order for the match, and
>     then scan all the entries to find the best match.
>       1. specific compatible && type && name
>       2. specific compatible && type
>       3. specific compatible && name
>       4. specific compatible
>       5. general compatible && type && name
>       6. general compatible && type
>       7. general compatible && name
>       8. general compatible
>       9. type && name
>       10. type
>       11. name
> 
>     This is based on some pseudo-codes provided by Grant Likely.
> 
>     Signed-off-by: Kevin Hao <haokexin@gmail.com>
>     [grant.likely: Changed multiplier to 4 which makes more sense]
>     Signed-off-by: Grant Likely <grant.likely@linaro.org>
> 
> :040000 040000 8f5dd19174417aece63b308ff299a5dbe2efa5a0
> 8401b0e3903e23e973845ee75b26b04345d803d2 M      drivers
> 
> As a double check, I checked out the head of linux-next, and did a
> revert of the above commit, and my sbc8548 can then boot properly.
> 
> Not doing anything fancy ; using the defconfig exactly as-is, and
> ensuring the dtb is fresh from linux-next HEAD of today.
> 
> Thanks,
> Paul.
> --
> 
> >
> > However, I think I would like to see this structured differently. We
> > basically have 2 ways of matching: the existing pre-3.14 way and the
> > desired match on best compatible only. All new bindings should match
> > with the new way and the old way needs to be kept for compatibility.
> > So lets structure the code that way. Search the match table first for
> > best compatible with name and type NULL, then search the table the old
> > way. I realize it appears you are doing this, but it is not clear this
> > is the intent of the code. I would like to see this written as a patch
> > with commit 105353145eafb3ea919 reverted first and you add a new match
> > function to call first and then fallback to the existing function.
> >
> > Rob
> >
> >>
> >> Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> >> Signed-off-by: Kevin Hao <haokexin@gmail.com>
> >> ---
> >>  drivers/of/base.c | 55 +++++++++++++++++++++++++++++++++++++------------------
> >>  1 file changed, 37 insertions(+), 18 deletions(-)
> >>
> >> diff --git a/drivers/of/base.c b/drivers/of/base.c
> >> index ff85450d5683..9d655df458bd 100644
> >> --- a/drivers/of/base.c
> >> +++ b/drivers/of/base.c
> >> @@ -730,32 +730,45 @@ out:
> >>  }
> >>  EXPORT_SYMBOL(of_find_node_with_property);
> >>
> >> +static int of_match_type_or_name(const struct device_node *node,
> >> +                               const struct of_device_id *m)
> >> +{
> >> +       int match = 1;
> >> +
> >> +       if (m->name[0])
> >> +               match &= node->name && !strcmp(m->name, node->name);
> >> +
> >> +       if (m->type[0])
> >> +               match &= node->type && !strcmp(m->type, node->type);
> >> +
> >> +       return match;
> >> +}
> >> +
> >>  static
> >>  const struct of_device_id *__of_match_node(const struct of_device_id *matches,
> >>                                            const struct device_node *node)
> >>  {
> >>         const char *cp;
> >>         int cplen, l;
> >> +       const struct of_device_id *m;
> >> +       int match;
> >>
> >>         if (!matches)
> >>                 return NULL;
> >>
> >>         cp = __of_get_property(node, "compatible", &cplen);
> >> -       do {
> >> -               const struct of_device_id *m = matches;
> >> +       while (cp && (cplen > 0)) {
> >> +               m = matches;
> >>
> >>                 /* Check against matches with current compatible string */
> >>                 while (m->name[0] || m->type[0] || m->compatible[0]) {
> >> -                       int match = 1;
> >> -                       if (m->name[0])
> >> -                               match &= node->name
> >> -                                       && !strcmp(m->name, node->name);
> >> -                       if (m->type[0])
> >> -                               match &= node->type
> >> -                                       && !strcmp(m->type, node->type);
> >> -                       if (m->compatible[0])
> >> -                               match &= cp
> >> -                                       && !of_compat_cmp(m->compatible, cp,
> >> +                       if (!m->compatible[0]) {
> >> +                               m++;
> >> +                               continue;
> >> +                       }
> >> +
> >> +                       match = of_match_type_or_name(node, m);
> >> +                       match &= cp && !of_compat_cmp(m->compatible, cp,
> >>                                                         strlen(m->compatible));
> >>                         if (match)
> >>                                 return m;
> >> @@ -763,12 +776,18 @@ const struct of_device_id *__of_match_node(const struct of_device_id *matches,
> >>                 }
> >>
> >>                 /* Get node's next compatible string */
> >> -               if (cp) {
> >> -                       l = strlen(cp) + 1;
> >> -                       cp += l;
> >> -                       cplen -= l;
> >> -               }
> >> -       } while (cp && (cplen > 0));
> >> +               l = strlen(cp) + 1;
> >> +               cp += l;
> >> +               cplen -= l;
> >> +       }
> >> +
> >> +       m = matches;
> >> +       /* Check against matches without compatible string */
> >> +       while (m->name[0] || m->type[0] || m->compatible[0]) {
> >> +               if (!m->compatible[0] && of_match_type_or_name(node, m))
> >> +                       return m;
> >> +               m++;
> >> +       }
> >>
> >>         return NULL;
> >>  }
> >> --
> >> 1.8.5.3
> >>
> >> --
> >> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> >> the body of a message to majordomo@vger.kernel.org
> >> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> > _______________________________________________
> > Linuxppc-dev mailing list
> > Linuxppc-dev@lists.ozlabs.org
> > https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply

* [PATCH v4 0/3] powerpc/pseries: fix issues in suspend/resume code
From: Tyrel Datwyler @ 2014-02-19 20:56 UTC (permalink / raw)
  To: benh; +Cc: nfont, linuxppc-dev, Tyrel Datwyler

This patchset fixes a couple of issues encountered in the suspend/resume code
base. First when using the kernel device tree update code update-nodes is
unnecessarily called more than once. Second the cpu cache lists are not
updated after a suspend/resume which under certain conditions may cause a
panic. Finally, since the cache list fix utilzes in kernel device tree update
code a means for telling drmgr that updating the device tree from userspace
is unnecessary.

Changes from v3:
- Updated patch descriptions to better reflect the behavior/interface changes
  and why they are acceptable per Ben's concerns.

Changes from v2:
- Moved dynamic configuration update code into pseries specific routine
  per Nathan's suggestion.

Changes from v1:
- Fixed several commit message typos
- Fixed authorship of first two patches

Haren Myneni (2):
  powerpc/pseries: Device tree should only be updated once after
    suspend/migrate
  powerpc/pseries: Update dynamic cache nodes for suspend/resume
    operation

Tyrel Datwyler (1):
  powerpc/pseries: Report in kernel device tree update to drmgr

 arch/powerpc/include/asm/rtas.h           |  1 +
 arch/powerpc/platforms/pseries/mobility.c | 26 +++++++-----------
 arch/powerpc/platforms/pseries/suspend.c  | 44 ++++++++++++++++++++++++++++++-
 3 files changed, 54 insertions(+), 17 deletions(-)

-- 
1.7.12.2

^ permalink raw reply

* [PATCH v4 1/3] powerpc/pseries: Device tree should only be updated once after suspend/migrate
From: Tyrel Datwyler @ 2014-02-19 20:56 UTC (permalink / raw)
  To: benh; +Cc: nfont, linuxppc-dev, Tyrel Datwyler
In-Reply-To: <1392843415-17153-1-git-send-email-tyreld@linux.vnet.ibm.com>

From: Haren Myneni <hbabu@us.ibm.com>

The current code makes rtas calls for update-nodes, activate-firmware and then
update-nodes again. The FW provides the same data for both update-nodes calls.
As a result a proc entry exists error is reported for the second update while
adding device nodes.

This patch makes a single rtas call for update-nodes after activating the FW.
It also add rtas_busy delay for the activate-firmware rtas call.

Signed-off-by: Haren Myneni <hbabu@us.ibm.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/pseries/mobility.c | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
index cde4e0a..bde7eba 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -290,13 +290,6 @@ void post_mobility_fixup(void)
 	int rc;
 	int activate_fw_token;
 
-	rc = pseries_devicetree_update(MIGRATION_SCOPE);
-	if (rc) {
-		printk(KERN_ERR "Initial post-mobility device tree update "
-		       "failed: %d\n", rc);
-		return;
-	}
-
 	activate_fw_token = rtas_token("ibm,activate-firmware");
 	if (activate_fw_token == RTAS_UNKNOWN_SERVICE) {
 		printk(KERN_ERR "Could not make post-mobility "
@@ -304,16 +297,17 @@ void post_mobility_fixup(void)
 		return;
 	}
 
-	rc = rtas_call(activate_fw_token, 0, 1, NULL);
-	if (!rc) {
-		rc = pseries_devicetree_update(MIGRATION_SCOPE);
-		if (rc)
-			printk(KERN_ERR "Secondary post-mobility device tree "
-			       "update failed: %d\n", rc);
-	} else {
+	do {
+		rc = rtas_call(activate_fw_token, 0, 1, NULL);
+	} while (rtas_busy_delay(rc));
+
+	if (rc)
 		printk(KERN_ERR "Post-mobility activate-fw failed: %d\n", rc);
-		return;
-	}
+
+	rc = pseries_devicetree_update(MIGRATION_SCOPE);
+	if (rc)
+		printk(KERN_ERR "Post-mobility device tree update "
+			"failed: %d\n", rc);
 
 	return;
 }
-- 
1.7.12.2

^ permalink raw reply related

* [PATCH v4 2/3] powerpc/pseries: Update dynamic cache nodes for suspend/resume operation
From: Tyrel Datwyler @ 2014-02-19 20:56 UTC (permalink / raw)
  To: benh; +Cc: nfont, linuxppc-dev, Tyrel Datwyler
In-Reply-To: <1392843415-17153-1-git-send-email-tyreld@linux.vnet.ibm.com>

From: Haren Myneni <hbabu@us.ibm.com>

pHyp can change cache nodes for suspend/resume operation. Currently the
device tree is updated by drmgr in userspace after all non boot CPUs are
enabled. Hence, we do not modify the cache list based on the latest cache
nodes. Also we do not remove cache entries for the primary CPU.

This patch removes the cache list for the boot CPU, updates the device tree
before enabling nonboot CPUs and adds cache list for the boot cpu.

This patch also has the side effect that older versions of drmgr will
perform a second device tree update from userspace. While this is a
redundant waste of a couple cycles it is harmless since firmware returns the
same data for the subsequent update-nodes/properties rtas calls.

Signed-off-by: Haren Myneni <hbabu@us.ibm.com>
Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
---
 arch/powerpc/include/asm/rtas.h          |  1 +
 arch/powerpc/platforms/pseries/suspend.c | 19 +++++++++++++++++++
 2 files changed, 20 insertions(+)

diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h
index 9bd52c6..a0e1add 100644
--- a/arch/powerpc/include/asm/rtas.h
+++ b/arch/powerpc/include/asm/rtas.h
@@ -283,6 +283,7 @@ extern void pSeries_log_error(char *buf, unsigned int err_type, int fatal);
 
 #ifdef CONFIG_PPC_PSERIES
 extern int pseries_devicetree_update(s32 scope);
+extern void post_mobility_fixup(void);
 #endif
 
 #ifdef CONFIG_PPC_RTAS_DAEMON
diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
index 16a2552..1d9c580 100644
--- a/arch/powerpc/platforms/pseries/suspend.c
+++ b/arch/powerpc/platforms/pseries/suspend.c
@@ -26,6 +26,7 @@
 #include <asm/mmu.h>
 #include <asm/rtas.h>
 #include <asm/topology.h>
+#include "../../kernel/cacheinfo.h"
 
 static u64 stream_id;
 static struct device suspend_dev;
@@ -79,6 +80,23 @@ static int pseries_suspend_cpu(void)
 }
 
 /**
+ * pseries_suspend_enable_irqs
+ *
+ * Post suspend configuration updates
+ *
+ **/
+static void pseries_suspend_enable_irqs(void)
+{
+	/*
+	 * Update configuration which can be modified based on device tree
+	 * changes during resume.
+	 */
+	cacheinfo_cpu_offline(smp_processor_id());
+	post_mobility_fixup();
+	cacheinfo_cpu_online(smp_processor_id());
+}
+
+/**
  * pseries_suspend_enter - Final phase of hibernation
  *
  * Return value:
@@ -235,6 +253,7 @@ static int __init pseries_suspend_init(void)
 		return rc;
 
 	ppc_md.suspend_disable_cpu = pseries_suspend_cpu;
+	ppc_md.suspend_enable_irqs = pseries_suspend_enable_irqs;
 	suspend_set_ops(&pseries_suspend_ops);
 	return 0;
 }
-- 
1.7.12.2

^ permalink raw reply related

* [PATCH v4 3/3] powerpc/pseries: Expose in kernel device tree update to drmgr
From: Tyrel Datwyler @ 2014-02-19 20:56 UTC (permalink / raw)
  To: benh; +Cc: nfont, linuxppc-dev, Tyrel Datwyler
In-Reply-To: <1392843415-17153-1-git-send-email-tyreld@linux.vnet.ibm.com>

Traditionally it has been drmgr's responsibilty to update the device tree
through the /proc/ppc64/ofdt interface after a suspend/resume operation.
This patchset however has modified suspend/resume ops to preform an update
entirely in the kernel during the resume. Therefore, a mechanism is required
to expose that information to drmgr.

This patch adds a show function to the "hibernate" attribute that returns 1
if the kernel performs a device tree update after the resume and 0 otherwise.
This allows newer versions of drmgr to avoid doing a second unnecessary
device tree update.

Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/pseries/suspend.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
index 1d9c580..b87b978 100644
--- a/arch/powerpc/platforms/pseries/suspend.c
+++ b/arch/powerpc/platforms/pseries/suspend.c
@@ -192,7 +192,30 @@ out:
 	return rc;
 }
 
-static DEVICE_ATTR(hibernate, S_IWUSR, NULL, store_hibernate);
+#define USER_DT_UPDATE	0
+#define KERN_DT_UPDATE	1
+
+/**
+ * show_hibernate - Report device tree update responsibilty
+ * @dev:		subsys root device
+ * @attr:		device attribute struct
+ * @buf:		buffer
+ *
+ * Report whether a device tree update is performed by the kernel after a
+ * resume, or if drmgr must coordinate the update from user space.
+ *
+ * Return value:
+ *	0 if drmgr is to initiate update, and 1 otherwise
+ **/
+static ssize_t show_hibernate(struct device *dev,
+			      struct device_attribute *attr,
+			      char *buf)
+{
+	return sprintf(buf, "%d\n", KERN_DT_UPDATE);
+}
+
+static DEVICE_ATTR(hibernate, S_IWUSR | S_IRUGO,
+		   show_hibernate, store_hibernate);
 
 static struct bus_type suspend_subsys = {
 	.name = "power",
-- 
1.7.12.2

^ permalink raw reply related

* [PATCH v3 3/3] powerpc/pseries: Report in kernel device tree update to drmgr
From: Tyrel Datwyler @ 2014-02-19 20:56 UTC (permalink / raw)
  To: benh; +Cc: nfont, linuxppc-dev, Tyrel Datwyler
In-Reply-To: <1392843415-17153-1-git-send-email-tyreld@linux.vnet.ibm.com>

Traditionally it has been drmgr's responsibilty to update the device tree
through the /proc/ppc64/ofdt interface after a suspend/resume operation.
This patchset however has modified suspend/resume ops to preform that update
entirely in the kernel during the resume. Therefore, a mechanism is required
for drmgr to determine who is responsible for the update. This patch adds a
show function to the "hibernate" attribute that returns 1 if the kernel
updates the device tree after the resume and 0 if drmgr is responsible.

Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/pseries/suspend.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
index 1d9c580..b87b978 100644
--- a/arch/powerpc/platforms/pseries/suspend.c
+++ b/arch/powerpc/platforms/pseries/suspend.c
@@ -192,7 +192,30 @@ out:
 	return rc;
 }
 
-static DEVICE_ATTR(hibernate, S_IWUSR, NULL, store_hibernate);
+#define USER_DT_UPDATE	0
+#define KERN_DT_UPDATE	1
+
+/**
+ * show_hibernate - Report device tree update responsibilty
+ * @dev:		subsys root device
+ * @attr:		device attribute struct
+ * @buf:		buffer
+ *
+ * Report whether a device tree update is performed by the kernel after a
+ * resume, or if drmgr must coordinate the update from user space.
+ *
+ * Return value:
+ *	0 if drmgr is to initiate update, and 1 otherwise
+ **/
+static ssize_t show_hibernate(struct device *dev,
+			      struct device_attribute *attr,
+			      char *buf)
+{
+	return sprintf(buf, "%d\n", KERN_DT_UPDATE);
+}
+
+static DEVICE_ATTR(hibernate, S_IWUSR | S_IRUGO,
+		   show_hibernate, store_hibernate);
 
 static struct bus_type suspend_subsys = {
 	.name = "power",
-- 
1.7.12.2

^ permalink raw reply related

* Re: [PATCH] of: give priority to the compatible match in __of_match_node()
From: Paul Gortmaker @ 2014-02-19 21:23 UTC (permalink / raw)
  To: Grant Likely, Rob Herring
  Cc: devicetree@vger.kernel.org, Kevin Hao, Arnd Bergmann,
	Chris Proctor, Stephen N Chivers, Rob Herring, Scott Wood,
	linuxppc-dev, Sebastian Hesselbarth
In-Reply-To: <20140219204134.E4A2DC4088D@trevor.secretlab.ca>

On 14-02-19 03:41 PM, Grant Likely wrote:
> On Wed, 19 Feb 2014 13:25:54 -0500, Paul Gortmaker <paul.gortmaker@windriver.com> wrote:
>> On Thu, Feb 13, 2014 at 2:01 PM, Rob Herring <robherring2@gmail.com> wrote:
>>> On Wed, Feb 12, 2014 at 5:38 AM, Kevin Hao <haokexin@gmail.com> wrote:
>>>> When the device node do have a compatible property, we definitely
>>>> prefer the compatible match besides the type and name. Only if
>>>> there is no such a match, we then consider the candidate which
>>>> doesn't have compatible entry but do match the type or name with
>>>> the device node.
>>>>
>>>> This is based on a patch from Sebastian Hesselbarth.
>>>>   http://patchwork.ozlabs.org/patch/319434/
>>>>
>>>> I did some code refactoring and also fixed a bug in the original patch.
>>>
>>> I'm inclined to just revert this once again and avoid possibly
>>> breaking yet another platform.
>>
>> Well, for what it is worth, today's (Feb19th) linux-next tree fails to boot
>> on my sbc8548.   It fails with:
> 
> I think I've got it fixed now with the latest series. Please try the
> devicetree/merge branch on git://git.secretlab.ca/git/linux

That seems to work.

libphy: Freescale PowerQUICC MII Bus: probed
libphy: Freescale PowerQUICC MII Bus: probed
fsl-gianfar e0024000.ethernet: enabled errata workarounds, flags: 0x4
fsl-gianfar e0024000.ethernet eth0: mac: 02:e0:0c:00:05:fd
fsl-gianfar e0024000.ethernet eth0: Running with NAPI enabled
fsl-gianfar e0024000.ethernet eth0: RX BD ring size for Q[0]: 256
fsl-gianfar e0024000.ethernet eth0: TX BD ring size for Q[0]: 256
fsl-gianfar e0025000.ethernet: enabled errata workarounds, flags: 0x4
fsl-gianfar e0025000.ethernet eth1: mac: 02:e0:0c:00:06:fd
fsl-gianfar e0025000.ethernet eth1: Running with NAPI enabled
fsl-gianfar e0025000.ethernet eth1: RX BD ring size for Q[0]: 256
fsl-gianfar e0025000.ethernet eth1: TX BD ring size for Q[0]: 256
TCP: cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 17

...

root@sbc8548:~# cat /proc/version 
Linux version 3.14.0-rc3-00024-g7119f42057c6 (paul@yow-lpgnfs-02) (gcc version 4.5.2 (GCC) ) #1 Wed Feb 19 16:08:17 EST 2014
root@sbc8548:~#

Paul.
--

> 
> g.
> 
>> -----------------------------------------------
>> libphy: Freescale PowerQUICC MII Bus: probed
>> mdio_bus ethernet@e002400: /soc8548@e0000000/ethernet@24000/mdio@520
>> PHY address 1312 is too large
>> libphy: Freescale PowerQUICC MII Bus: probed
>> libphy: Freescale PowerQUICC MII Bus: probed
>> mdio_bus ethernet@e002500: /soc8548@e0000000/ethernet@25000/mdio@520
>> PHY address 1312 is too large
>> libphy: Freescale PowerQUICC MII Bus: probed
>> TCP: cubic registered
>> Initializing XFRM netlink socket
>> NET: Registered protocol family 17
>> <fail nfs mount>
>> -----------------------------------------------
>>
>> On a normal boot, we should see this:
>> -----------------------------------------------
>> libphy: Freescale PowerQUICC MII Bus: probed
>> libphy: Freescale PowerQUICC MII Bus: probed
>> fsl-gianfar e0024000.ethernet: enabled errata workarounds, flags: 0x4
>> fsl-gianfar e0024000.ethernet eth0: mac: 02:e0:0c:00:05:fd
>> fsl-gianfar e0024000.ethernet eth0: Running with NAPI enabled
>> fsl-gianfar e0024000.ethernet eth0: RX BD ring size for Q[0]: 256
>> fsl-gianfar e0024000.ethernet eth0: TX BD ring size for Q[0]: 256
>> fsl-gianfar e0025000.ethernet: enabled errata workarounds, flags: 0x4
>> fsl-gianfar e0025000.ethernet eth1: mac: 02:e0:0c:00:06:fd
>> fsl-gianfar e0025000.ethernet eth1: Running with NAPI enabled
>> fsl-gianfar e0025000.ethernet eth1: RX BD ring size for Q[0]: 256
>> fsl-gianfar e0025000.ethernet eth1: TX BD ring size for Q[0]: 256
>> TCP: cubic registered
>> Initializing XFRM netlink socket
>> NET: Registered protocol family 17
>> -----------------------------------------------
>>
>>
>> Git bisect says:
>>
>> ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4 is the first bad commit
>> commit ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4
>> Author: Kevin Hao <haokexin@gmail.com>
>> Date:   Tue Feb 18 15:57:30 2014 +0800
>>
>>     of: reimplement the matching method for __of_match_node()
>>
>>     In the current implementation of __of_match_node(), it will compare
>>     each given match entry against all the node's compatible strings
>>     with of_device_is_compatible().
>>
>>     To achieve multiple compatible strings per node with ordering from
>>     specific to generic, this requires given matches to be ordered from
>>     specific to generic. For most of the drivers this is not true and
>>     also an alphabetical ordering is more sane there.
>>
>>     Therefore, we define a following priority order for the match, and
>>     then scan all the entries to find the best match.
>>       1. specific compatible && type && name
>>       2. specific compatible && type
>>       3. specific compatible && name
>>       4. specific compatible
>>       5. general compatible && type && name
>>       6. general compatible && type
>>       7. general compatible && name
>>       8. general compatible
>>       9. type && name
>>       10. type
>>       11. name
>>
>>     This is based on some pseudo-codes provided by Grant Likely.
>>
>>     Signed-off-by: Kevin Hao <haokexin@gmail.com>
>>     [grant.likely: Changed multiplier to 4 which makes more sense]
>>     Signed-off-by: Grant Likely <grant.likely@linaro.org>
>>
>> :040000 040000 8f5dd19174417aece63b308ff299a5dbe2efa5a0
>> 8401b0e3903e23e973845ee75b26b04345d803d2 M      drivers
>>
>> As a double check, I checked out the head of linux-next, and did a
>> revert of the above commit, and my sbc8548 can then boot properly.
>>
>> Not doing anything fancy ; using the defconfig exactly as-is, and
>> ensuring the dtb is fresh from linux-next HEAD of today.
>>
>> Thanks,
>> Paul.
>> --
>>
>>>
>>> However, I think I would like to see this structured differently. We
>>> basically have 2 ways of matching: the existing pre-3.14 way and the
>>> desired match on best compatible only. All new bindings should match
>>> with the new way and the old way needs to be kept for compatibility.
>>> So lets structure the code that way. Search the match table first for
>>> best compatible with name and type NULL, then search the table the old
>>> way. I realize it appears you are doing this, but it is not clear this
>>> is the intent of the code. I would like to see this written as a patch
>>> with commit 105353145eafb3ea919 reverted first and you add a new match
>>> function to call first and then fallback to the existing function.
>>>
>>> Rob
>>>
>>>>
>>>> Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
>>>> Signed-off-by: Kevin Hao <haokexin@gmail.com>
>>>> ---
>>>>  drivers/of/base.c | 55 +++++++++++++++++++++++++++++++++++++------------------
>>>>  1 file changed, 37 insertions(+), 18 deletions(-)
>>>>
>>>> diff --git a/drivers/of/base.c b/drivers/of/base.c
>>>> index ff85450d5683..9d655df458bd 100644
>>>> --- a/drivers/of/base.c
>>>> +++ b/drivers/of/base.c
>>>> @@ -730,32 +730,45 @@ out:
>>>>  }
>>>>  EXPORT_SYMBOL(of_find_node_with_property);
>>>>
>>>> +static int of_match_type_or_name(const struct device_node *node,
>>>> +                               const struct of_device_id *m)
>>>> +{
>>>> +       int match = 1;
>>>> +
>>>> +       if (m->name[0])
>>>> +               match &= node->name && !strcmp(m->name, node->name);
>>>> +
>>>> +       if (m->type[0])
>>>> +               match &= node->type && !strcmp(m->type, node->type);
>>>> +
>>>> +       return match;
>>>> +}
>>>> +
>>>>  static
>>>>  const struct of_device_id *__of_match_node(const struct of_device_id *matches,
>>>>                                            const struct device_node *node)
>>>>  {
>>>>         const char *cp;
>>>>         int cplen, l;
>>>> +       const struct of_device_id *m;
>>>> +       int match;
>>>>
>>>>         if (!matches)
>>>>                 return NULL;
>>>>
>>>>         cp = __of_get_property(node, "compatible", &cplen);
>>>> -       do {
>>>> -               const struct of_device_id *m = matches;
>>>> +       while (cp && (cplen > 0)) {
>>>> +               m = matches;
>>>>
>>>>                 /* Check against matches with current compatible string */
>>>>                 while (m->name[0] || m->type[0] || m->compatible[0]) {
>>>> -                       int match = 1;
>>>> -                       if (m->name[0])
>>>> -                               match &= node->name
>>>> -                                       && !strcmp(m->name, node->name);
>>>> -                       if (m->type[0])
>>>> -                               match &= node->type
>>>> -                                       && !strcmp(m->type, node->type);
>>>> -                       if (m->compatible[0])
>>>> -                               match &= cp
>>>> -                                       && !of_compat_cmp(m->compatible, cp,
>>>> +                       if (!m->compatible[0]) {
>>>> +                               m++;
>>>> +                               continue;
>>>> +                       }
>>>> +
>>>> +                       match = of_match_type_or_name(node, m);
>>>> +                       match &= cp && !of_compat_cmp(m->compatible, cp,
>>>>                                                         strlen(m->compatible));
>>>>                         if (match)
>>>>                                 return m;
>>>> @@ -763,12 +776,18 @@ const struct of_device_id *__of_match_node(const struct of_device_id *matches,
>>>>                 }
>>>>
>>>>                 /* Get node's next compatible string */
>>>> -               if (cp) {
>>>> -                       l = strlen(cp) + 1;
>>>> -                       cp += l;
>>>> -                       cplen -= l;
>>>> -               }
>>>> -       } while (cp && (cplen > 0));
>>>> +               l = strlen(cp) + 1;
>>>> +               cp += l;
>>>> +               cplen -= l;
>>>> +       }
>>>> +
>>>> +       m = matches;
>>>> +       /* Check against matches without compatible string */
>>>> +       while (m->name[0] || m->type[0] || m->compatible[0]) {
>>>> +               if (!m->compatible[0] && of_match_type_or_name(node, m))
>>>> +                       return m;
>>>> +               m++;
>>>> +       }
>>>>
>>>>         return NULL;
>>>>  }
>>>> --
>>>> 1.8.5.3
>>>>
>>>> --
>>>> To unsubscribe from this list: send the line "unsubscribe devicetree" in
>>>> the body of a message to majordomo@vger.kernel.org
>>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>> _______________________________________________
>>> Linuxppc-dev mailing list
>>> Linuxppc-dev@lists.ozlabs.org
>>> https://lists.ozlabs.org/listinfo/linuxppc-dev
> 

^ permalink raw reply

* Re: ppc: RECLAIM_DISTANCE 10?
From: David Rientjes @ 2014-02-19 21:45 UTC (permalink / raw)
  To: Michal Hocko; +Cc: linuxppc-dev, Anton Blanchard, LKML, linux-mm
In-Reply-To: <20140219091959.GD14783@dhcp22.suse.cz>

On Wed, 19 Feb 2014, Michal Hocko wrote:

> Interesting. So is the PPC NUMA basically about local vs. very distant?

The point is that it's impossible to tell how distant they are from one 
NUMA domain to the next NUMA domain.

> Should REMOTE_DISTANCE reflect that as well? Or can we have 
> distance < REMOTE_DISTANCE and it would still make sense to have
> zone_reclaim enabled?
> 

Ppc doesn't want to allocate in a different NUMA domain unless required, 
the latency of a remote access is too high.  Everything that isn't in the 
same domain has a distance >10 and is setup as 2^(domain hops) * 10.  We 
don't have the ability like with a SLIT to define remote nodes to have 
local latency vs remote or costly latency so the safe setting is a 
RECLAIM_DISTANCE of 10.

^ permalink raw reply

* Re: [RFC PATCH 2/3] topology: support node_numa_mem() for determining the fallback node
From: David Rientjes @ 2014-02-19 22:03 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: Han Pingtian, Nishanth Aravamudan, Pekka Enberg,
	Linux Memory Management List, Paul Mackerras, Anton Blanchard,
	Matt Mackall, Joonsoo Kim, linuxppc-dev, Wanpeng Li
In-Reply-To: <alpine.DEB.2.10.1402181356120.2910@nuc>

On Tue, 18 Feb 2014, Christoph Lameter wrote:

> Ok but since you have a virtualized environment: Why not provide a fake
> home node with fake memory that could be anywhere? This would avoid the
> whole problem of supporting such a config at the kernel level.
> 

By acpi, the abstraction of a NUMA node can include any combination of 
cpus, memory, I/O resources, networking, or storage devices.  This allows 
two memoryless nodes, for example, to have different proximity to memory.

^ permalink raw reply

* Re: [RFC PATCH 2/3] topology: support node_numa_mem() for determining the fallback node
From: David Rientjes @ 2014-02-19 22:04 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: Han Pingtian, Nishanth Aravamudan, Pekka Enberg,
	Linux Memory Management List, Paul Mackerras, Anton Blanchard,
	Matt Mackall, Joonsoo Kim, linuxppc-dev, Wanpeng Li
In-Reply-To: <alpine.DEB.2.10.1402181033480.28964@nuc>

On Tue, 18 Feb 2014, Christoph Lameter wrote:

> Its an optimization to avoid calling the page allocator to figure out if
> there is memory available on a particular node.
> 

Thus this patch breaks with memory hot-add for a memoryless node.

^ permalink raw reply

* [PATCH] powerpc: select MEMORY for FSL_IFC to not break existing .config files
From: Paul Gortmaker @ 2014-02-19 22:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Arnd Bergmann, Paul Gortmaker, linux-next, Paul Mackerras,
	linuxppc-dev, Prabhakar Kushwaha

commit d2ae2e20fbdde5a65f3a5a153044ab1e5c53f7cc ("driver/memory:Move
Freescale IFC driver to a common driver") introduces this build
regression into the mpc85xx_defconfig:

 drivers/built-in.o: In function `fsl_ifc_nand_remove':
 drivers/mtd/nand/fsl_ifc_nand.c:1147: undefined reference to `fsl_ifc_ctrl_dev'
 drivers/mtd/nand/fsl_ifc_nand.c:1147: undefined reference to `fsl_ifc_ctrl_dev'
 drivers/built-in.o: In function `fsl_ifc_nand_probe':
 drivers/mtd/nand/fsl_ifc_nand.c:1031: undefined reference to `fsl_ifc_ctrl_dev'
 drivers/mtd/nand/fsl_ifc_nand.c:1031: undefined reference to `fsl_ifc_ctrl_dev'
 drivers/built-in.o: In function `match_bank':
 drivers/mtd/nand/fsl_ifc_nand.c:1013: undefined reference to `convert_ifc_address'
 drivers/built-in.o: In function `fsl_ifc_nand_probe':
 drivers/mtd/nand/fsl_ifc_nand.c:1059: undefined reference to `fsl_ifc_ctrl_dev'
 drivers/mtd/nand/fsl_ifc_nand.c:1080: undefined reference to `fsl_ifc_ctrl_dev'
 drivers/mtd/nand/fsl_ifc_nand.c:1069: undefined reference to `fsl_ifc_ctrl_dev'
 drivers/mtd/nand/fsl_ifc_nand.c:1069: undefined reference to `fsl_ifc_ctrl_dev'
 make: *** [vmlinux] Error 1

This happens because there is nothing to descend us into the
drivers/memory directory in the mpc85xx_defconfig.  It wasn't
selecting CONFIG_MEMORY.  So we never built drivers/memory/fsl_ifc.o
even with CONFIG_FSL_IFC=y, and so we have nothing to link against.

In order to remain compatible with old config files and to avoid
such build failures, make CONFIG_FSL_IFC select CONFIG_MEMORY.
Also fix the whitespace issue (spaces vs. a tab) in the Kconfig.

Cc: Prabhakar Kushwaha <prabhakar@freescale.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---

[This probably makes sense to go in via Greg's char-misc/char-misc-next
 (vs. powerpc-next) since that is where the regression was introduced.]

 arch/powerpc/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 957bf344c0f5..d2d8d8f50610 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -738,7 +738,8 @@ config FSL_LBC
 
 config FSL_IFC
 	bool
-        depends on FSL_SOC
+	depends on FSL_SOC
+	select MEMORY
 
 config FSL_GTM
 	bool
-- 
1.8.5.2

^ permalink raw reply related

* Re: [PATCH v3 3/3] powerpc/pseries: Report in kernel device tree update to drmgr
From: Tyrel Datwyler @ 2014-02-19 22:07 UTC (permalink / raw)
  To: benh; +Cc: nfont, linuxppc-dev, Tyrel Datwyler
In-Reply-To: <1392843415-17153-5-git-send-email-tyreld@linux.vnet.ibm.com>

On 02/19/2014 12:56 PM, Tyrel Datwyler wrote:
> Traditionally it has been drmgr's responsibilty to update the device tree
> through the /proc/ppc64/ofdt interface after a suspend/resume operation.
> This patchset however has modified suspend/resume ops to preform that update
> entirely in the kernel during the resume. Therefore, a mechanism is required
> for drmgr to determine who is responsible for the update. This patch adds a
> show function to the "hibernate" attribute that returns 1 if the kernel
> updates the device tree after the resume and 0 if drmgr is responsible.

Ignore this one. Apparently, I forgot to clear it out of my patch
directory before I resent.

> 
> Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
> ---
>  arch/powerpc/platforms/pseries/suspend.c | 25 ++++++++++++++++++++++++-
>  1 file changed, 24 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
> index 1d9c580..b87b978 100644
> --- a/arch/powerpc/platforms/pseries/suspend.c
> +++ b/arch/powerpc/platforms/pseries/suspend.c
> @@ -192,7 +192,30 @@ out:
>  	return rc;
>  }
> 
> -static DEVICE_ATTR(hibernate, S_IWUSR, NULL, store_hibernate);
> +#define USER_DT_UPDATE	0
> +#define KERN_DT_UPDATE	1
> +
> +/**
> + * show_hibernate - Report device tree update responsibilty
> + * @dev:		subsys root device
> + * @attr:		device attribute struct
> + * @buf:		buffer
> + *
> + * Report whether a device tree update is performed by the kernel after a
> + * resume, or if drmgr must coordinate the update from user space.
> + *
> + * Return value:
> + *	0 if drmgr is to initiate update, and 1 otherwise
> + **/
> +static ssize_t show_hibernate(struct device *dev,
> +			      struct device_attribute *attr,
> +			      char *buf)
> +{
> +	return sprintf(buf, "%d\n", KERN_DT_UPDATE);
> +}
> +
> +static DEVICE_ATTR(hibernate, S_IWUSR | S_IRUGO,
> +		   show_hibernate, store_hibernate);
> 
>  static struct bus_type suspend_subsys = {
>  	.name = "power",
> 

^ permalink raw reply

* Re: [PATCH] powerpc: select MEMORY for FSL_IFC to not break existing .config files
From: Scott Wood @ 2014-02-19 22:19 UTC (permalink / raw)
  To: Paul Gortmaker
  Cc: Arnd Bergmann, Greg Kroah-Hartman, linux-next, Paul Mackerras,
	linuxppc-dev, Prabhakar Kushwaha
In-Reply-To: <1392847641-63777-1-git-send-email-paul.gortmaker@windriver.com>

On Wed, 2014-02-19 at 17:07 -0500, Paul Gortmaker wrote:
> commit d2ae2e20fbdde5a65f3a5a153044ab1e5c53f7cc ("driver/memory:Move
> Freescale IFC driver to a common driver") introduces this build
> regression into the mpc85xx_defconfig:
> 
>  drivers/built-in.o: In function `fsl_ifc_nand_remove':
>  drivers/mtd/nand/fsl_ifc_nand.c:1147: undefined reference to `fsl_ifc_ctrl_dev'
>  drivers/mtd/nand/fsl_ifc_nand.c:1147: undefined reference to `fsl_ifc_ctrl_dev'
>  drivers/built-in.o: In function `fsl_ifc_nand_probe':
>  drivers/mtd/nand/fsl_ifc_nand.c:1031: undefined reference to `fsl_ifc_ctrl_dev'
>  drivers/mtd/nand/fsl_ifc_nand.c:1031: undefined reference to `fsl_ifc_ctrl_dev'
>  drivers/built-in.o: In function `match_bank':
>  drivers/mtd/nand/fsl_ifc_nand.c:1013: undefined reference to `convert_ifc_address'
>  drivers/built-in.o: In function `fsl_ifc_nand_probe':
>  drivers/mtd/nand/fsl_ifc_nand.c:1059: undefined reference to `fsl_ifc_ctrl_dev'
>  drivers/mtd/nand/fsl_ifc_nand.c:1080: undefined reference to `fsl_ifc_ctrl_dev'
>  drivers/mtd/nand/fsl_ifc_nand.c:1069: undefined reference to `fsl_ifc_ctrl_dev'
>  drivers/mtd/nand/fsl_ifc_nand.c:1069: undefined reference to `fsl_ifc_ctrl_dev'
>  make: *** [vmlinux] Error 1
> 
> This happens because there is nothing to descend us into the
> drivers/memory directory in the mpc85xx_defconfig.  It wasn't
> selecting CONFIG_MEMORY.  So we never built drivers/memory/fsl_ifc.o
> even with CONFIG_FSL_IFC=y, and so we have nothing to link against.
> 
> In order to remain compatible with old config files and to avoid
> such build failures, make CONFIG_FSL_IFC select CONFIG_MEMORY.
> Also fix the whitespace issue (spaces vs. a tab) in the Kconfig.
> 
> Cc: Prabhakar Kushwaha <prabhakar@freescale.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
> ---
> 
> [This probably makes sense to go in via Greg's char-misc/char-misc-next
>  (vs. powerpc-next) since that is where the regression was introduced.]
> 
>  arch/powerpc/Kconfig | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
> index 957bf344c0f5..d2d8d8f50610 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -738,7 +738,8 @@ config FSL_LBC
>  
>  config FSL_IFC
>  	bool
> -        depends on FSL_SOC
> +	depends on FSL_SOC
> +	select MEMORY

Why do we still have FSL_IFC in arch/powerpc/Kconfig if the driver has
been moved?  The NAND driver and other selectors of FSL_IFC can select
MEMORY.

-Scott

^ permalink raw reply

* Re: [PATCH] powerpc: select MEMORY for FSL_IFC to not break existing .config files
From: Paul Gortmaker @ 2014-02-19 22:25 UTC (permalink / raw)
  To: Scott Wood
  Cc: Arnd Bergmann, Greg Kroah-Hartman, linux-next, Paul Mackerras,
	linuxppc-dev, Prabhakar Kushwaha
In-Reply-To: <1392848350.6733.809.camel@snotra.buserror.net>

On 14-02-19 05:19 PM, Scott Wood wrote:
> On Wed, 2014-02-19 at 17:07 -0500, Paul Gortmaker wrote:
>> commit d2ae2e20fbdde5a65f3a5a153044ab1e5c53f7cc ("driver/memory:Move
>> Freescale IFC driver to a common driver") introduces this build
>> regression into the mpc85xx_defconfig:
>>
>>  drivers/built-in.o: In function `fsl_ifc_nand_remove':
>>  drivers/mtd/nand/fsl_ifc_nand.c:1147: undefined reference to `fsl_ifc_ctrl_dev'
>>  drivers/mtd/nand/fsl_ifc_nand.c:1147: undefined reference to `fsl_ifc_ctrl_dev'
>>  drivers/built-in.o: In function `fsl_ifc_nand_probe':
>>  drivers/mtd/nand/fsl_ifc_nand.c:1031: undefined reference to `fsl_ifc_ctrl_dev'
>>  drivers/mtd/nand/fsl_ifc_nand.c:1031: undefined reference to `fsl_ifc_ctrl_dev'
>>  drivers/built-in.o: In function `match_bank':
>>  drivers/mtd/nand/fsl_ifc_nand.c:1013: undefined reference to `convert_ifc_address'
>>  drivers/built-in.o: In function `fsl_ifc_nand_probe':
>>  drivers/mtd/nand/fsl_ifc_nand.c:1059: undefined reference to `fsl_ifc_ctrl_dev'
>>  drivers/mtd/nand/fsl_ifc_nand.c:1080: undefined reference to `fsl_ifc_ctrl_dev'
>>  drivers/mtd/nand/fsl_ifc_nand.c:1069: undefined reference to `fsl_ifc_ctrl_dev'
>>  drivers/mtd/nand/fsl_ifc_nand.c:1069: undefined reference to `fsl_ifc_ctrl_dev'
>>  make: *** [vmlinux] Error 1
>>
>> This happens because there is nothing to descend us into the
>> drivers/memory directory in the mpc85xx_defconfig.  It wasn't
>> selecting CONFIG_MEMORY.  So we never built drivers/memory/fsl_ifc.o
>> even with CONFIG_FSL_IFC=y, and so we have nothing to link against.
>>
>> In order to remain compatible with old config files and to avoid
>> such build failures, make CONFIG_FSL_IFC select CONFIG_MEMORY.
>> Also fix the whitespace issue (spaces vs. a tab) in the Kconfig.
>>
>> Cc: Prabhakar Kushwaha <prabhakar@freescale.com>
>> Cc: Arnd Bergmann <arnd@arndb.de>
>> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
>> ---
>>
>> [This probably makes sense to go in via Greg's char-misc/char-misc-next
>>  (vs. powerpc-next) since that is where the regression was introduced.]
>>
>>  arch/powerpc/Kconfig | 3 ++-
>>  1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
>> index 957bf344c0f5..d2d8d8f50610 100644
>> --- a/arch/powerpc/Kconfig
>> +++ b/arch/powerpc/Kconfig
>> @@ -738,7 +738,8 @@ config FSL_LBC
>>  
>>  config FSL_IFC
>>  	bool
>> -        depends on FSL_SOC
>> +	depends on FSL_SOC
>> +	select MEMORY
> 
> Why do we still have FSL_IFC in arch/powerpc/Kconfig if the driver has
> been moved?  The NAND driver and other selectors of FSL_IFC can select
> MEMORY.

At the risk of a slightly larger footprint to the regression fix,
I'd agree that is a better overall solution.  I'll code that up.

Unless folks want the regression fix as-is, and then the move?

Paul.
--

> 
> -Scott
> 
> 

^ permalink raw reply

* Re: [PATCH] of: give priority to the compatible match in __of_match_node()
From: Grant Likely @ 2014-02-19 22:40 UTC (permalink / raw)
  To: Paul Gortmaker, Rob Herring
  Cc: devicetree@vger.kernel.org, Kevin Hao, Arnd Bergmann,
	Chris Proctor, Stephen N Chivers, Rob Herring, Scott Wood,
	linuxppc-dev, Sebastian Hesselbarth
In-Reply-To: <530520B6.8050205@windriver.com>

On Wed, 19 Feb 2014 16:23:02 -0500, Paul Gortmaker <paul.gortmaker@windriver.com> wrote:
> On 14-02-19 03:41 PM, Grant Likely wrote:
> > On Wed, 19 Feb 2014 13:25:54 -0500, Paul Gortmaker <paul.gortmaker@windriver.com> wrote:
> >> On Thu, Feb 13, 2014 at 2:01 PM, Rob Herring <robherring2@gmail.com> wrote:
> >>> On Wed, Feb 12, 2014 at 5:38 AM, Kevin Hao <haokexin@gmail.com> wrote:
> >>>> When the device node do have a compatible property, we definitely
> >>>> prefer the compatible match besides the type and name. Only if
> >>>> there is no such a match, we then consider the candidate which
> >>>> doesn't have compatible entry but do match the type or name with
> >>>> the device node.
> >>>>
> >>>> This is based on a patch from Sebastian Hesselbarth.
> >>>>   http://patchwork.ozlabs.org/patch/319434/
> >>>>
> >>>> I did some code refactoring and also fixed a bug in the original patch.
> >>>
> >>> I'm inclined to just revert this once again and avoid possibly
> >>> breaking yet another platform.
> >>
> >> Well, for what it is worth, today's (Feb19th) linux-next tree fails to boot
> >> on my sbc8548.   It fails with:
> > 
> > I think I've got it fixed now with the latest series. Please try the
> > devicetree/merge branch on git://git.secretlab.ca/git/linux
> 
> That seems to work.

Great, thanks for the testing. Can I add a Tested-by line for you?

g.

> 
> libphy: Freescale PowerQUICC MII Bus: probed
> libphy: Freescale PowerQUICC MII Bus: probed
> fsl-gianfar e0024000.ethernet: enabled errata workarounds, flags: 0x4
> fsl-gianfar e0024000.ethernet eth0: mac: 02:e0:0c:00:05:fd
> fsl-gianfar e0024000.ethernet eth0: Running with NAPI enabled
> fsl-gianfar e0024000.ethernet eth0: RX BD ring size for Q[0]: 256
> fsl-gianfar e0024000.ethernet eth0: TX BD ring size for Q[0]: 256
> fsl-gianfar e0025000.ethernet: enabled errata workarounds, flags: 0x4
> fsl-gianfar e0025000.ethernet eth1: mac: 02:e0:0c:00:06:fd
> fsl-gianfar e0025000.ethernet eth1: Running with NAPI enabled
> fsl-gianfar e0025000.ethernet eth1: RX BD ring size for Q[0]: 256
> fsl-gianfar e0025000.ethernet eth1: TX BD ring size for Q[0]: 256
> TCP: cubic registered
> Initializing XFRM netlink socket
> NET: Registered protocol family 17
> 
> ...
> 
> root@sbc8548:~# cat /proc/version 
> Linux version 3.14.0-rc3-00024-g7119f42057c6 (paul@yow-lpgnfs-02) (gcc version 4.5.2 (GCC) ) #1 Wed Feb 19 16:08:17 EST 2014
> root@sbc8548:~#
> 
> Paul.
> --
> 
> > 
> > g.
> > 
> >> -----------------------------------------------
> >> libphy: Freescale PowerQUICC MII Bus: probed
> >> mdio_bus ethernet@e002400: /soc8548@e0000000/ethernet@24000/mdio@520
> >> PHY address 1312 is too large
> >> libphy: Freescale PowerQUICC MII Bus: probed
> >> libphy: Freescale PowerQUICC MII Bus: probed
> >> mdio_bus ethernet@e002500: /soc8548@e0000000/ethernet@25000/mdio@520
> >> PHY address 1312 is too large
> >> libphy: Freescale PowerQUICC MII Bus: probed
> >> TCP: cubic registered
> >> Initializing XFRM netlink socket
> >> NET: Registered protocol family 17
> >> <fail nfs mount>
> >> -----------------------------------------------
> >>
> >> On a normal boot, we should see this:
> >> -----------------------------------------------
> >> libphy: Freescale PowerQUICC MII Bus: probed
> >> libphy: Freescale PowerQUICC MII Bus: probed
> >> fsl-gianfar e0024000.ethernet: enabled errata workarounds, flags: 0x4
> >> fsl-gianfar e0024000.ethernet eth0: mac: 02:e0:0c:00:05:fd
> >> fsl-gianfar e0024000.ethernet eth0: Running with NAPI enabled
> >> fsl-gianfar e0024000.ethernet eth0: RX BD ring size for Q[0]: 256
> >> fsl-gianfar e0024000.ethernet eth0: TX BD ring size for Q[0]: 256
> >> fsl-gianfar e0025000.ethernet: enabled errata workarounds, flags: 0x4
> >> fsl-gianfar e0025000.ethernet eth1: mac: 02:e0:0c:00:06:fd
> >> fsl-gianfar e0025000.ethernet eth1: Running with NAPI enabled
> >> fsl-gianfar e0025000.ethernet eth1: RX BD ring size for Q[0]: 256
> >> fsl-gianfar e0025000.ethernet eth1: TX BD ring size for Q[0]: 256
> >> TCP: cubic registered
> >> Initializing XFRM netlink socket
> >> NET: Registered protocol family 17
> >> -----------------------------------------------
> >>
> >>
> >> Git bisect says:
> >>
> >> ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4 is the first bad commit
> >> commit ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4
> >> Author: Kevin Hao <haokexin@gmail.com>
> >> Date:   Tue Feb 18 15:57:30 2014 +0800
> >>
> >>     of: reimplement the matching method for __of_match_node()
> >>
> >>     In the current implementation of __of_match_node(), it will compare
> >>     each given match entry against all the node's compatible strings
> >>     with of_device_is_compatible().
> >>
> >>     To achieve multiple compatible strings per node with ordering from
> >>     specific to generic, this requires given matches to be ordered from
> >>     specific to generic. For most of the drivers this is not true and
> >>     also an alphabetical ordering is more sane there.
> >>
> >>     Therefore, we define a following priority order for the match, and
> >>     then scan all the entries to find the best match.
> >>       1. specific compatible && type && name
> >>       2. specific compatible && type
> >>       3. specific compatible && name
> >>       4. specific compatible
> >>       5. general compatible && type && name
> >>       6. general compatible && type
> >>       7. general compatible && name
> >>       8. general compatible
> >>       9. type && name
> >>       10. type
> >>       11. name
> >>
> >>     This is based on some pseudo-codes provided by Grant Likely.
> >>
> >>     Signed-off-by: Kevin Hao <haokexin@gmail.com>
> >>     [grant.likely: Changed multiplier to 4 which makes more sense]
> >>     Signed-off-by: Grant Likely <grant.likely@linaro.org>
> >>
> >> :040000 040000 8f5dd19174417aece63b308ff299a5dbe2efa5a0
> >> 8401b0e3903e23e973845ee75b26b04345d803d2 M      drivers
> >>
> >> As a double check, I checked out the head of linux-next, and did a
> >> revert of the above commit, and my sbc8548 can then boot properly.
> >>
> >> Not doing anything fancy ; using the defconfig exactly as-is, and
> >> ensuring the dtb is fresh from linux-next HEAD of today.
> >>
> >> Thanks,
> >> Paul.
> >> --
> >>
> >>>
> >>> However, I think I would like to see this structured differently. We
> >>> basically have 2 ways of matching: the existing pre-3.14 way and the
> >>> desired match on best compatible only. All new bindings should match
> >>> with the new way and the old way needs to be kept for compatibility.
> >>> So lets structure the code that way. Search the match table first for
> >>> best compatible with name and type NULL, then search the table the old
> >>> way. I realize it appears you are doing this, but it is not clear this
> >>> is the intent of the code. I would like to see this written as a patch
> >>> with commit 105353145eafb3ea919 reverted first and you add a new match
> >>> function to call first and then fallback to the existing function.
> >>>
> >>> Rob
> >>>
> >>>>
> >>>> Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> >>>> Signed-off-by: Kevin Hao <haokexin@gmail.com>
> >>>> ---
> >>>>  drivers/of/base.c | 55 +++++++++++++++++++++++++++++++++++++------------------
> >>>>  1 file changed, 37 insertions(+), 18 deletions(-)
> >>>>
> >>>> diff --git a/drivers/of/base.c b/drivers/of/base.c
> >>>> index ff85450d5683..9d655df458bd 100644
> >>>> --- a/drivers/of/base.c
> >>>> +++ b/drivers/of/base.c
> >>>> @@ -730,32 +730,45 @@ out:
> >>>>  }
> >>>>  EXPORT_SYMBOL(of_find_node_with_property);
> >>>>
> >>>> +static int of_match_type_or_name(const struct device_node *node,
> >>>> +                               const struct of_device_id *m)
> >>>> +{
> >>>> +       int match = 1;
> >>>> +
> >>>> +       if (m->name[0])
> >>>> +               match &= node->name && !strcmp(m->name, node->name);
> >>>> +
> >>>> +       if (m->type[0])
> >>>> +               match &= node->type && !strcmp(m->type, node->type);
> >>>> +
> >>>> +       return match;
> >>>> +}
> >>>> +
> >>>>  static
> >>>>  const struct of_device_id *__of_match_node(const struct of_device_id *matches,
> >>>>                                            const struct device_node *node)
> >>>>  {
> >>>>         const char *cp;
> >>>>         int cplen, l;
> >>>> +       const struct of_device_id *m;
> >>>> +       int match;
> >>>>
> >>>>         if (!matches)
> >>>>                 return NULL;
> >>>>
> >>>>         cp = __of_get_property(node, "compatible", &cplen);
> >>>> -       do {
> >>>> -               const struct of_device_id *m = matches;
> >>>> +       while (cp && (cplen > 0)) {
> >>>> +               m = matches;
> >>>>
> >>>>                 /* Check against matches with current compatible string */
> >>>>                 while (m->name[0] || m->type[0] || m->compatible[0]) {
> >>>> -                       int match = 1;
> >>>> -                       if (m->name[0])
> >>>> -                               match &= node->name
> >>>> -                                       && !strcmp(m->name, node->name);
> >>>> -                       if (m->type[0])
> >>>> -                               match &= node->type
> >>>> -                                       && !strcmp(m->type, node->type);
> >>>> -                       if (m->compatible[0])
> >>>> -                               match &= cp
> >>>> -                                       && !of_compat_cmp(m->compatible, cp,
> >>>> +                       if (!m->compatible[0]) {
> >>>> +                               m++;
> >>>> +                               continue;
> >>>> +                       }
> >>>> +
> >>>> +                       match = of_match_type_or_name(node, m);
> >>>> +                       match &= cp && !of_compat_cmp(m->compatible, cp,
> >>>>                                                         strlen(m->compatible));
> >>>>                         if (match)
> >>>>                                 return m;
> >>>> @@ -763,12 +776,18 @@ const struct of_device_id *__of_match_node(const struct of_device_id *matches,
> >>>>                 }
> >>>>
> >>>>                 /* Get node's next compatible string */
> >>>> -               if (cp) {
> >>>> -                       l = strlen(cp) + 1;
> >>>> -                       cp += l;
> >>>> -                       cplen -= l;
> >>>> -               }
> >>>> -       } while (cp && (cplen > 0));
> >>>> +               l = strlen(cp) + 1;
> >>>> +               cp += l;
> >>>> +               cplen -= l;
> >>>> +       }
> >>>> +
> >>>> +       m = matches;
> >>>> +       /* Check against matches without compatible string */
> >>>> +       while (m->name[0] || m->type[0] || m->compatible[0]) {
> >>>> +               if (!m->compatible[0] && of_match_type_or_name(node, m))
> >>>> +                       return m;
> >>>> +               m++;
> >>>> +       }
> >>>>
> >>>>         return NULL;
> >>>>  }
> >>>> --
> >>>> 1.8.5.3
> >>>>
> >>>> --
> >>>> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> >>>> the body of a message to majordomo@vger.kernel.org
> >>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >>> _______________________________________________
> >>> Linuxppc-dev mailing list
> >>> Linuxppc-dev@lists.ozlabs.org
> >>> https://lists.ozlabs.org/listinfo/linuxppc-dev
> > 

^ permalink raw reply

* Re: [PATCH] of: give priority to the compatible match in __of_match_node()
From: Paul Gortmaker @ 2014-02-19 22:44 UTC (permalink / raw)
  To: Grant Likely, Rob Herring
  Cc: devicetree@vger.kernel.org, Kevin Hao, Arnd Bergmann,
	Chris Proctor, Stephen N Chivers, Rob Herring, Scott Wood,
	linuxppc-dev, Sebastian Hesselbarth
In-Reply-To: <20140219224051.65BB7C4077A@trevor.secretlab.ca>

On 14-02-19 05:40 PM, Grant Likely wrote:
> On Wed, 19 Feb 2014 16:23:02 -0500, Paul Gortmaker <paul.gortmaker@windriver.com> wrote:
>> On 14-02-19 03:41 PM, Grant Likely wrote:
>>> On Wed, 19 Feb 2014 13:25:54 -0500, Paul Gortmaker <paul.gortmaker@windriver.com> wrote:
>>>> On Thu, Feb 13, 2014 at 2:01 PM, Rob Herring <robherring2@gmail.com> wrote:
>>>>> On Wed, Feb 12, 2014 at 5:38 AM, Kevin Hao <haokexin@gmail.com> wrote:
>>>>>> When the device node do have a compatible property, we definitely
>>>>>> prefer the compatible match besides the type and name. Only if
>>>>>> there is no such a match, we then consider the candidate which
>>>>>> doesn't have compatible entry but do match the type or name with
>>>>>> the device node.
>>>>>>
>>>>>> This is based on a patch from Sebastian Hesselbarth.
>>>>>>   http://patchwork.ozlabs.org/patch/319434/
>>>>>>
>>>>>> I did some code refactoring and also fixed a bug in the original patch.
>>>>>
>>>>> I'm inclined to just revert this once again and avoid possibly
>>>>> breaking yet another platform.
>>>>
>>>> Well, for what it is worth, today's (Feb19th) linux-next tree fails to boot
>>>> on my sbc8548.   It fails with:
>>>
>>> I think I've got it fixed now with the latest series. Please try the
>>> devicetree/merge branch on git://git.secretlab.ca/git/linux
>>
>> That seems to work.
> 
> Great, thanks for the testing. Can I add a Tested-by line for you?

Absolutely; sorry for not thinking to explicitly indicate that.

P.
--

> 
> g.
> 
>>
>> libphy: Freescale PowerQUICC MII Bus: probed
>> libphy: Freescale PowerQUICC MII Bus: probed
>> fsl-gianfar e0024000.ethernet: enabled errata workarounds, flags: 0x4
>> fsl-gianfar e0024000.ethernet eth0: mac: 02:e0:0c:00:05:fd
>> fsl-gianfar e0024000.ethernet eth0: Running with NAPI enabled
>> fsl-gianfar e0024000.ethernet eth0: RX BD ring size for Q[0]: 256
>> fsl-gianfar e0024000.ethernet eth0: TX BD ring size for Q[0]: 256
>> fsl-gianfar e0025000.ethernet: enabled errata workarounds, flags: 0x4
>> fsl-gianfar e0025000.ethernet eth1: mac: 02:e0:0c:00:06:fd
>> fsl-gianfar e0025000.ethernet eth1: Running with NAPI enabled
>> fsl-gianfar e0025000.ethernet eth1: RX BD ring size for Q[0]: 256
>> fsl-gianfar e0025000.ethernet eth1: TX BD ring size for Q[0]: 256
>> TCP: cubic registered
>> Initializing XFRM netlink socket
>> NET: Registered protocol family 17
>>
>> ...
>>
>> root@sbc8548:~# cat /proc/version 
>> Linux version 3.14.0-rc3-00024-g7119f42057c6 (paul@yow-lpgnfs-02) (gcc version 4.5.2 (GCC) ) #1 Wed Feb 19 16:08:17 EST 2014
>> root@sbc8548:~#
>>
>> Paul.
>> --
>>
>>>
>>> g.
>>>
>>>> -----------------------------------------------
>>>> libphy: Freescale PowerQUICC MII Bus: probed
>>>> mdio_bus ethernet@e002400: /soc8548@e0000000/ethernet@24000/mdio@520
>>>> PHY address 1312 is too large
>>>> libphy: Freescale PowerQUICC MII Bus: probed
>>>> libphy: Freescale PowerQUICC MII Bus: probed
>>>> mdio_bus ethernet@e002500: /soc8548@e0000000/ethernet@25000/mdio@520
>>>> PHY address 1312 is too large
>>>> libphy: Freescale PowerQUICC MII Bus: probed
>>>> TCP: cubic registered
>>>> Initializing XFRM netlink socket
>>>> NET: Registered protocol family 17
>>>> <fail nfs mount>
>>>> -----------------------------------------------
>>>>
>>>> On a normal boot, we should see this:
>>>> -----------------------------------------------
>>>> libphy: Freescale PowerQUICC MII Bus: probed
>>>> libphy: Freescale PowerQUICC MII Bus: probed
>>>> fsl-gianfar e0024000.ethernet: enabled errata workarounds, flags: 0x4
>>>> fsl-gianfar e0024000.ethernet eth0: mac: 02:e0:0c:00:05:fd
>>>> fsl-gianfar e0024000.ethernet eth0: Running with NAPI enabled
>>>> fsl-gianfar e0024000.ethernet eth0: RX BD ring size for Q[0]: 256
>>>> fsl-gianfar e0024000.ethernet eth0: TX BD ring size for Q[0]: 256
>>>> fsl-gianfar e0025000.ethernet: enabled errata workarounds, flags: 0x4
>>>> fsl-gianfar e0025000.ethernet eth1: mac: 02:e0:0c:00:06:fd
>>>> fsl-gianfar e0025000.ethernet eth1: Running with NAPI enabled
>>>> fsl-gianfar e0025000.ethernet eth1: RX BD ring size for Q[0]: 256
>>>> fsl-gianfar e0025000.ethernet eth1: TX BD ring size for Q[0]: 256
>>>> TCP: cubic registered
>>>> Initializing XFRM netlink socket
>>>> NET: Registered protocol family 17
>>>> -----------------------------------------------
>>>>
>>>>
>>>> Git bisect says:
>>>>
>>>> ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4 is the first bad commit
>>>> commit ee8b26ad943aa34acc03ae6cde2b81d8d3d483d4
>>>> Author: Kevin Hao <haokexin@gmail.com>
>>>> Date:   Tue Feb 18 15:57:30 2014 +0800
>>>>
>>>>     of: reimplement the matching method for __of_match_node()
>>>>
>>>>     In the current implementation of __of_match_node(), it will compare
>>>>     each given match entry against all the node's compatible strings
>>>>     with of_device_is_compatible().
>>>>
>>>>     To achieve multiple compatible strings per node with ordering from
>>>>     specific to generic, this requires given matches to be ordered from
>>>>     specific to generic. For most of the drivers this is not true and
>>>>     also an alphabetical ordering is more sane there.
>>>>
>>>>     Therefore, we define a following priority order for the match, and
>>>>     then scan all the entries to find the best match.
>>>>       1. specific compatible && type && name
>>>>       2. specific compatible && type
>>>>       3. specific compatible && name
>>>>       4. specific compatible
>>>>       5. general compatible && type && name
>>>>       6. general compatible && type
>>>>       7. general compatible && name
>>>>       8. general compatible
>>>>       9. type && name
>>>>       10. type
>>>>       11. name
>>>>
>>>>     This is based on some pseudo-codes provided by Grant Likely.
>>>>
>>>>     Signed-off-by: Kevin Hao <haokexin@gmail.com>
>>>>     [grant.likely: Changed multiplier to 4 which makes more sense]
>>>>     Signed-off-by: Grant Likely <grant.likely@linaro.org>
>>>>
>>>> :040000 040000 8f5dd19174417aece63b308ff299a5dbe2efa5a0
>>>> 8401b0e3903e23e973845ee75b26b04345d803d2 M      drivers
>>>>
>>>> As a double check, I checked out the head of linux-next, and did a
>>>> revert of the above commit, and my sbc8548 can then boot properly.
>>>>
>>>> Not doing anything fancy ; using the defconfig exactly as-is, and
>>>> ensuring the dtb is fresh from linux-next HEAD of today.
>>>>
>>>> Thanks,
>>>> Paul.
>>>> --
>>>>
>>>>>
>>>>> However, I think I would like to see this structured differently. We
>>>>> basically have 2 ways of matching: the existing pre-3.14 way and the
>>>>> desired match on best compatible only. All new bindings should match
>>>>> with the new way and the old way needs to be kept for compatibility.
>>>>> So lets structure the code that way. Search the match table first for
>>>>> best compatible with name and type NULL, then search the table the old
>>>>> way. I realize it appears you are doing this, but it is not clear this
>>>>> is the intent of the code. I would like to see this written as a patch
>>>>> with commit 105353145eafb3ea919 reverted first and you add a new match
>>>>> function to call first and then fallback to the existing function.
>>>>>
>>>>> Rob
>>>>>
>>>>>>
>>>>>> Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
>>>>>> Signed-off-by: Kevin Hao <haokexin@gmail.com>
>>>>>> ---
>>>>>>  drivers/of/base.c | 55 +++++++++++++++++++++++++++++++++++++------------------
>>>>>>  1 file changed, 37 insertions(+), 18 deletions(-)
>>>>>>
>>>>>> diff --git a/drivers/of/base.c b/drivers/of/base.c
>>>>>> index ff85450d5683..9d655df458bd 100644
>>>>>> --- a/drivers/of/base.c
>>>>>> +++ b/drivers/of/base.c
>>>>>> @@ -730,32 +730,45 @@ out:
>>>>>>  }
>>>>>>  EXPORT_SYMBOL(of_find_node_with_property);
>>>>>>
>>>>>> +static int of_match_type_or_name(const struct device_node *node,
>>>>>> +                               const struct of_device_id *m)
>>>>>> +{
>>>>>> +       int match = 1;
>>>>>> +
>>>>>> +       if (m->name[0])
>>>>>> +               match &= node->name && !strcmp(m->name, node->name);
>>>>>> +
>>>>>> +       if (m->type[0])
>>>>>> +               match &= node->type && !strcmp(m->type, node->type);
>>>>>> +
>>>>>> +       return match;
>>>>>> +}
>>>>>> +
>>>>>>  static
>>>>>>  const struct of_device_id *__of_match_node(const struct of_device_id *matches,
>>>>>>                                            const struct device_node *node)
>>>>>>  {
>>>>>>         const char *cp;
>>>>>>         int cplen, l;
>>>>>> +       const struct of_device_id *m;
>>>>>> +       int match;
>>>>>>
>>>>>>         if (!matches)
>>>>>>                 return NULL;
>>>>>>
>>>>>>         cp = __of_get_property(node, "compatible", &cplen);
>>>>>> -       do {
>>>>>> -               const struct of_device_id *m = matches;
>>>>>> +       while (cp && (cplen > 0)) {
>>>>>> +               m = matches;
>>>>>>
>>>>>>                 /* Check against matches with current compatible string */
>>>>>>                 while (m->name[0] || m->type[0] || m->compatible[0]) {
>>>>>> -                       int match = 1;
>>>>>> -                       if (m->name[0])
>>>>>> -                               match &= node->name
>>>>>> -                                       && !strcmp(m->name, node->name);
>>>>>> -                       if (m->type[0])
>>>>>> -                               match &= node->type
>>>>>> -                                       && !strcmp(m->type, node->type);
>>>>>> -                       if (m->compatible[0])
>>>>>> -                               match &= cp
>>>>>> -                                       && !of_compat_cmp(m->compatible, cp,
>>>>>> +                       if (!m->compatible[0]) {
>>>>>> +                               m++;
>>>>>> +                               continue;
>>>>>> +                       }
>>>>>> +
>>>>>> +                       match = of_match_type_or_name(node, m);
>>>>>> +                       match &= cp && !of_compat_cmp(m->compatible, cp,
>>>>>>                                                         strlen(m->compatible));
>>>>>>                         if (match)
>>>>>>                                 return m;
>>>>>> @@ -763,12 +776,18 @@ const struct of_device_id *__of_match_node(const struct of_device_id *matches,
>>>>>>                 }
>>>>>>
>>>>>>                 /* Get node's next compatible string */
>>>>>> -               if (cp) {
>>>>>> -                       l = strlen(cp) + 1;
>>>>>> -                       cp += l;
>>>>>> -                       cplen -= l;
>>>>>> -               }
>>>>>> -       } while (cp && (cplen > 0));
>>>>>> +               l = strlen(cp) + 1;
>>>>>> +               cp += l;
>>>>>> +               cplen -= l;
>>>>>> +       }
>>>>>> +
>>>>>> +       m = matches;
>>>>>> +       /* Check against matches without compatible string */
>>>>>> +       while (m->name[0] || m->type[0] || m->compatible[0]) {
>>>>>> +               if (!m->compatible[0] && of_match_type_or_name(node, m))
>>>>>> +                       return m;
>>>>>> +               m++;
>>>>>> +       }
>>>>>>
>>>>>>         return NULL;
>>>>>>  }
>>>>>> --
>>>>>> 1.8.5.3
>>>>>>
>>>>>> --
>>>>>> To unsubscribe from this list: send the line "unsubscribe devicetree" in
>>>>>> the body of a message to majordomo@vger.kernel.org
>>>>>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>>>> _______________________________________________
>>>>> Linuxppc-dev mailing list
>>>>> Linuxppc-dev@lists.ozlabs.org
>>>>> https://lists.ozlabs.org/listinfo/linuxppc-dev
>>>
> 

^ permalink raw reply

* [PATCH v2] powerpc: select MEMORY for FSL_IFC to not break existing .config files
From: Paul Gortmaker @ 2014-02-19 22:46 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Arnd Bergmann, Paul Gortmaker, linux-next, linux-mtd, Scott Wood,
	Paul Mackerras, linuxppc-dev, David Woodhouse, Prabhakar Kushwaha
In-Reply-To: <1392848350.6733.809.camel@snotra.buserror.net>

commit d2ae2e20fbdde5a65f3a5a153044ab1e5c53f7cc ("driver/memory:Move
Freescale IFC driver to a common driver") introduces this build
regression into the mpc85xx_defconfig:

 drivers/built-in.o: In function `fsl_ifc_nand_remove':
 drivers/mtd/nand/fsl_ifc_nand.c:1147: undefined reference to `fsl_ifc_ctrl_dev'
 drivers/mtd/nand/fsl_ifc_nand.c:1147: undefined reference to `fsl_ifc_ctrl_dev'
 drivers/built-in.o: In function `fsl_ifc_nand_probe':
 drivers/mtd/nand/fsl_ifc_nand.c:1031: undefined reference to `fsl_ifc_ctrl_dev'
 drivers/mtd/nand/fsl_ifc_nand.c:1031: undefined reference to `fsl_ifc_ctrl_dev'
 drivers/built-in.o: In function `match_bank':
 drivers/mtd/nand/fsl_ifc_nand.c:1013: undefined reference to `convert_ifc_address'
 drivers/built-in.o: In function `fsl_ifc_nand_probe':
 drivers/mtd/nand/fsl_ifc_nand.c:1059: undefined reference to `fsl_ifc_ctrl_dev'
 drivers/mtd/nand/fsl_ifc_nand.c:1080: undefined reference to `fsl_ifc_ctrl_dev'
 drivers/mtd/nand/fsl_ifc_nand.c:1069: undefined reference to `fsl_ifc_ctrl_dev'
 drivers/mtd/nand/fsl_ifc_nand.c:1069: undefined reference to `fsl_ifc_ctrl_dev'
 make: *** [vmlinux] Error 1

This happens because there is nothing to descend us into the
drivers/memory directory in the mpc85xx_defconfig.  It wasn't
selecting CONFIG_MEMORY.  So we never built drivers/memory/fsl_ifc.o
and so we have nothing to link the above symbols against.

Since the goal of the original commit was to relocate the driver to
an arch independent location, it only makes sense to relocate the
Kconfig setting there as well.  But that alone won't fix the build
failure; for that we ensure whoever selects FSL_IFC also selects MEMORY.

Cc: Prabhakar Kushwaha <prabhakar@freescale.com>
Cc: Scott Wood <scottwood@freescale.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: David Woodhouse <dwmw2@infradead.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---

[v2: fix the mislocated FSL_IFC as per Scott's comment.  It still
 probably makes sense to go in via Greg's char-misc/char-misc-next
 (vs. powerpc-next) since that is where the regression was introduced.]

 arch/powerpc/Kconfig     | 4 ----
 drivers/memory/Kconfig   | 4 ++++
 drivers/mtd/nand/Kconfig | 1 +
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 957bf344c0f5..b9fcecc706ab 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -736,10 +736,6 @@ config FSL_LBC
 	  controller.  Also contains some common code used by
 	  drivers for specific local bus peripherals.
 
-config FSL_IFC
-	bool
-        depends on FSL_SOC
-
 config FSL_GTM
 	bool
 	depends on PPC_83xx || QUICC_ENGINE || CPM2
diff --git a/drivers/memory/Kconfig b/drivers/memory/Kconfig
index 29a11db365bc..a3640fe9852f 100644
--- a/drivers/memory/Kconfig
+++ b/drivers/memory/Kconfig
@@ -50,4 +50,8 @@ config TEGRA30_MC
 	  analysis, especially for IOMMU/SMMU(System Memory Management
 	  Unit) module.
 
+config FSL_IFC
+	bool
+	depends on FSL_SOC
+
 endif
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 90ff447bf043..a4bee41ad5cb 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -428,6 +428,7 @@ config MTD_NAND_FSL_IFC
 	tristate "NAND support for Freescale IFC controller"
 	depends on MTD_NAND && FSL_SOC
 	select FSL_IFC
+	select MEMORY
 	help
 	  Various Freescale chips e.g P1010, include a NAND Flash machine
 	  with built-in hardware ECC capabilities.
-- 
1.8.5.2

^ permalink raw reply related

* [PATCH 0/3] powerpc: support memoryless nodes
From: Nishanth Aravamudan @ 2014-02-19 23:16 UTC (permalink / raw)
  To: Nish Aravamudan
  Cc: Michal Hocko, linux-mm, Mel Gorman, David Rientjes,
	Christoph Lameter, linuxppc-dev, Joonsoo Kim, Anton Blanchard

We have seen several issues recently on powerpc LPARs with memoryless
node NUMA configurations, e.g. (an extreme case):

numactl --hardware
available: 2 nodes (0,3)
node 0 cpus:
node 0 size: 0 MB
node 0 free: 0 MB
node 3 cpus: 0 1 2 3
node 3 size: 8142 MB
node 3 free: 7765 MB
node distances:
node   0   3 
  0:  10  20 
  3:  20  10 

powerpc doesn't set CONFIG_HAVE_MEMORYLESS_NODES, so we are missing out
on a lot of the core-kernel support necessary. This series attempts to
fix this by enabling the config option, which requires a few other
changes as well.

1/3: mm: return NUMA_NO_NODE in local_memory_node if zonelists are not
setup
2/3: powerpc: enable CONFIG_HAVE_PERCPU_NUMA_NODE_ID
3/3: powerpc: enable CONFIG_HAVE_MEMORYLESS_NODES

I have tested this series with Christoph's patch (currently being
discussed): http://www.spinics.net/lists/linux-mm/msg69452.html

Thanks,
Nish

^ permalink raw reply

* [PATCH 1/3] mm: return NUMA_NO_NODE in local_memory_node if zonelists are not setup
From: Nishanth Aravamudan @ 2014-02-19 23:17 UTC (permalink / raw)
  To: Michal Hocko, Mel Gorman, linux-mm, Christoph Lameter,
	David Rientjes, Joonsoo Kim, Ben Herrenschmidt, Anton Blanchard,
	linuxppc-dev
In-Reply-To: <20140219231641.GA413@linux.vnet.ibm.com>

We can call local_memory_node() before the zonelists are setup. In that
case, first_zones_zonelist() will not set zone and the reference to
zone->node will Oops. Catch this case, and, since we presumably running
very early, just return that any node will do.

Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Mel Gorman <mgorman@suse.de>
Cc: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org
Cc: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Ben Herrenschmidt <benh@kernel.crashing.org>
Cc: Anton Blanchard <anton@samba.org>

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index e3758a0..5de4337 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3650,6 +3650,8 @@ int local_memory_node(int node)
 				   gfp_zone(GFP_KERNEL),
 				   NULL,
 				   &zone);
+	if (!zone)
+		return NUMA_NO_NODE;
 	return zone->node;
 }
 #endif

^ permalink raw reply related

* [PATCH 2/3] powerpc: enable CONFIG_HAVE_PERCPU_NUMA_NODE_ID
From: Nishanth Aravamudan @ 2014-02-19 23:18 UTC (permalink / raw)
  To: Michal Hocko, Mel Gorman, linux-mm, Christoph Lameter,
	David Rientjes, Joonsoo Kim, Ben Herrenschmidt, Anton Blanchard,
	linuxppc-dev
In-Reply-To: <20140219231714.GB413@linux.vnet.ibm.com>

In order to enable CONFIG_HAVE_MEMORYLESS_NODES, it is necessary to have
somewhere to store the cpu <-> local-memory-node mapping. We could
create another powerpc-specific lookup table, but the generic functions
in include/linux/topology.h (protected by HAVE_PERCPU_NUMA_NODE_ID) are
sufficient. This also allows us to remove the existing powerpc-specific
cpu <-> node lookup table.
    
Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>

diff --git a/arch/powerpc/include/asm/mmzone.h b/arch/powerpc/include/asm/mmzone.h
index 7b58917..c8fbd1c 100644
--- a/arch/powerpc/include/asm/mmzone.h
+++ b/arch/powerpc/include/asm/mmzone.h
@@ -29,7 +29,6 @@ extern struct pglist_data *node_data[];
  * Following are specific to this numa platform.
  */
 
-extern int numa_cpu_lookup_table[];
 extern cpumask_var_t node_to_cpumask_map[];
 #ifdef CONFIG_MEMORY_HOTPLUG
 extern unsigned long max_pfn;
diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index d0b5fca..8bbe8cc 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -20,19 +20,6 @@ struct device_node;
 
 #include <asm/mmzone.h>
 
-static inline int cpu_to_node(int cpu)
-{
-	int nid;
-
-	nid = numa_cpu_lookup_table[cpu];
-
-	/*
-	 * During early boot, the numa-cpu lookup table might not have been
-	 * setup for all CPUs yet. In such cases, default to node 0.
-	 */
-	return (nid < 0) ? 0 : nid;
-}
-
 #define parent_node(node)	(node)
 
 #define cpumask_of_node(node) ((node) == -1 ?				\
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index ac2621a..f45e68d 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -739,6 +739,9 @@ void start_secondary(void *unused)
 	}
 	traverse_core_siblings(cpu, true);
 
+	set_cpu_numa_node(cpu, cpu_to_node(cpu));
+	set_cpu_numa_mem(cpu, local_memory_node(cpu_to_node(cpu)));
+
 	smp_wmb();
 	notify_cpu_starting(cpu);
 	set_cpu_online(cpu, true);
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 30a42e2..57e2809 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -46,11 +46,9 @@ static char *cmdline __initdata;
 static int numa_debug;
 #define dbg(args...) if (numa_debug) { printk(KERN_INFO args); }
 
-int numa_cpu_lookup_table[NR_CPUS];
 cpumask_var_t node_to_cpumask_map[MAX_NUMNODES];
 struct pglist_data *node_data[MAX_NUMNODES];
 
-EXPORT_SYMBOL(numa_cpu_lookup_table);
 EXPORT_SYMBOL(node_to_cpumask_map);
 EXPORT_SYMBOL(node_data);
 
@@ -154,22 +152,25 @@ static void __init get_node_active_region(unsigned long pfn,
 	}
 }
 
-static void reset_numa_cpu_lookup_table(void)
+static void reset_numa_cpu_node(void)
 {
 	unsigned int cpu;
 
-	for_each_possible_cpu(cpu)
-		numa_cpu_lookup_table[cpu] = -1;
+	for_each_possible_cpu(cpu) {
+		set_cpu_numa_node(cpu, -1);
+		set_cpu_numa_mem(cpu, -1);
+	}
 }
 
-static void update_numa_cpu_lookup_table(unsigned int cpu, int node)
+static void update_numa_cpu_node(unsigned int cpu, int node)
 {
-	numa_cpu_lookup_table[cpu] = node;
+	set_cpu_numa_node(cpu, node);
+	set_cpu_numa_mem(cpu, local_memory_node(node));
 }
 
 static void map_cpu_to_node(int cpu, int node)
 {
-	update_numa_cpu_lookup_table(cpu, node);
+	update_numa_cpu_node(cpu, node);
 
 	dbg("adding cpu %d to node %d\n", cpu, node);
 
@@ -180,7 +181,7 @@ static void map_cpu_to_node(int cpu, int node)
 #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_PPC_SPLPAR)
 static void unmap_cpu_from_node(unsigned long cpu)
 {
-	int node = numa_cpu_lookup_table[cpu];
+	int node = cpu_to_node(cpu);
 
 	dbg("removing cpu %lu from node %d\n", cpu, node);
 
@@ -545,7 +546,7 @@ static int numa_setup_cpu(unsigned long lcpu)
 	 * directly instead of querying the firmware, since it represents
 	 * the most recent mapping notified to us by the platform (eg: VPHN).
 	 */
-	if ((nid = numa_cpu_lookup_table[lcpu]) >= 0) {
+	if ((nid = cpu_to_node(lcpu)) >= 0) {
 		map_cpu_to_node(lcpu, nid);
 		return nid;
 	}
@@ -1119,7 +1120,7 @@ void __init do_init_bootmem(void)
 	 */
 	setup_node_to_cpumask_map();
 
-	reset_numa_cpu_lookup_table();
+	reset_numa_cpu_node();
 	register_cpu_notifier(&ppc64_numa_nb);
 	cpu_numa_callback(&ppc64_numa_nb, CPU_UP_PREPARE,
 			  (void *)(unsigned long)boot_cpuid);
@@ -1518,7 +1519,7 @@ static int update_lookup_table(void *data)
 		base = cpu_first_thread_sibling(update->cpu);
 
 		for (j = 0; j < threads_per_core; j++) {
-			update_numa_cpu_lookup_table(base + j, nid);
+			update_numa_cpu_node(base + j, nid);
 		}
 	}
 
@@ -1571,7 +1572,7 @@ int arch_update_cpu_topology(void)
 		if (new_nid < 0 || !node_online(new_nid))
 			new_nid = first_online_node;
 
-		if (new_nid == numa_cpu_lookup_table[cpu]) {
+		if (new_nid == cpu_to_node(cpu)) {
 			cpumask_andnot(&cpu_associativity_changes_mask,
 					&cpu_associativity_changes_mask,
 					cpu_sibling_mask(cpu));
@@ -1583,7 +1584,7 @@ int arch_update_cpu_topology(void)
 			ud = &updates[i++];
 			ud->cpu = sibling;
 			ud->new_nid = new_nid;
-			ud->old_nid = numa_cpu_lookup_table[sibling];
+			ud->old_nid = cpu_to_node(sibling);
 			cpumask_set_cpu(sibling, &updated_cpus);
 			if (i < weight)
 				ud->next = &updates[i];

^ permalink raw reply related

* [PATCH 2/3 v2] powerpc: enable CONFIG_HAVE_PERCPU_NUMA_NODE_ID
From: Nishanth Aravamudan @ 2014-02-19 23:22 UTC (permalink / raw)
  To: Michal Hocko, Mel Gorman, linux-mm, Christoph Lameter,
	David Rientjes, Joonsoo Kim, Ben Herrenschmidt, Anton Blanchard,
	linuxppc-dev
In-Reply-To: <20140219231800.GC413@linux.vnet.ibm.com>

[Apologies, I sent a stale version of this patch a moment ago...]

In order to enable CONFIG_HAVE_MEMORYLESS_NODES, it is necessary to have
somewhere to store the cpu <-> local-memory-node mapping. We could
create another powerpc-specific lookup table, but the generic functions
in include/linux/topology.h (protected by HAVE_PERCPU_NUMA_NODE_ID) are
sufficient. This also allows us to remove the existing powerpc-specific
cpu <-> node lookup table.

Signed-off-by: Nishanth Aravamudan <nacc@linux.vnet.ibm.com>
Cc: Ben Herrenschmidt <benh@kernel.crashing.org>
Cc: Christoph Lameter <cl@linux.com>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Anton Blanchard <anton@samba.org>
Cc: linuxppc-dev@lists.ozlabs.org

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 957bf34..a84816c 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -449,6 +449,10 @@ config NODES_SHIFT
 	default "4"
 	depends on NEED_MULTIPLE_NODES
 
+config USE_PERCPU_NUMA_NODE_ID
+	def_bool y
+	depends on NUMA
+
 config ARCH_SELECT_MEMORY_MODEL
 	def_bool y
 	depends on PPC64
diff --git a/arch/powerpc/include/asm/mmzone.h b/arch/powerpc/include/asm/mmzone.h
index 7b58917..c8fbd1c 100644
--- a/arch/powerpc/include/asm/mmzone.h
+++ b/arch/powerpc/include/asm/mmzone.h
@@ -29,7 +29,6 @@ extern struct pglist_data *node_data[];
  * Following are specific to this numa platform.
  */
 
-extern int numa_cpu_lookup_table[];
 extern cpumask_var_t node_to_cpumask_map[];
 #ifdef CONFIG_MEMORY_HOTPLUG
 extern unsigned long max_pfn;
diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index d0b5fca..8bbe8cc 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -20,19 +20,6 @@ struct device_node;
 
 #include <asm/mmzone.h>
 
-static inline int cpu_to_node(int cpu)
-{
-	int nid;
-
-	nid = numa_cpu_lookup_table[cpu];
-
-	/*
-	 * During early boot, the numa-cpu lookup table might not have been
-	 * setup for all CPUs yet. In such cases, default to node 0.
-	 */
-	return (nid < 0) ? 0 : nid;
-}
-
 #define parent_node(node)	(node)
 
 #define cpumask_of_node(node) ((node) == -1 ?				\
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index ac2621a..f45e68d 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -739,6 +739,9 @@ void start_secondary(void *unused)
 	}
 	traverse_core_siblings(cpu, true);
 
+	set_cpu_numa_node(cpu, cpu_to_node(cpu));
+	set_cpu_numa_mem(cpu, local_memory_node(cpu_to_node(cpu)));
+
 	smp_wmb();
 	notify_cpu_starting(cpu);
 	set_cpu_online(cpu, true);
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index 30a42e2..57e2809 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -46,11 +46,9 @@ static char *cmdline __initdata;
 static int numa_debug;
 #define dbg(args...) if (numa_debug) { printk(KERN_INFO args); }
 
-int numa_cpu_lookup_table[NR_CPUS];
 cpumask_var_t node_to_cpumask_map[MAX_NUMNODES];
 struct pglist_data *node_data[MAX_NUMNODES];
 
-EXPORT_SYMBOL(numa_cpu_lookup_table);
 EXPORT_SYMBOL(node_to_cpumask_map);
 EXPORT_SYMBOL(node_data);
 
@@ -154,22 +152,25 @@ static void __init get_node_active_region(unsigned long pfn,
 	}
 }
 
-static void reset_numa_cpu_lookup_table(void)
+static void reset_numa_cpu_node(void)
 {
 	unsigned int cpu;
 
-	for_each_possible_cpu(cpu)
-		numa_cpu_lookup_table[cpu] = -1;
+	for_each_possible_cpu(cpu) {
+		set_cpu_numa_node(cpu, -1);
+		set_cpu_numa_mem(cpu, -1);
+	}
 }
 
-static void update_numa_cpu_lookup_table(unsigned int cpu, int node)
+static void update_numa_cpu_node(unsigned int cpu, int node)
 {
-	numa_cpu_lookup_table[cpu] = node;
+	set_cpu_numa_node(cpu, node);
+	set_cpu_numa_mem(cpu, local_memory_node(node));
 }
 
 static void map_cpu_to_node(int cpu, int node)
 {
-	update_numa_cpu_lookup_table(cpu, node);
+	update_numa_cpu_node(cpu, node);
 
 	dbg("adding cpu %d to node %d\n", cpu, node);
 
@@ -180,7 +181,7 @@ static void map_cpu_to_node(int cpu, int node)
 #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_PPC_SPLPAR)
 static void unmap_cpu_from_node(unsigned long cpu)
 {
-	int node = numa_cpu_lookup_table[cpu];
+	int node = cpu_to_node(cpu);
 
 	dbg("removing cpu %lu from node %d\n", cpu, node);
 
@@ -545,7 +546,7 @@ static int numa_setup_cpu(unsigned long lcpu)
 	 * directly instead of querying the firmware, since it represents
 	 * the most recent mapping notified to us by the platform (eg: VPHN).
 	 */
-	if ((nid = numa_cpu_lookup_table[lcpu]) >= 0) {
+	if ((nid = cpu_to_node(lcpu)) >= 0) {
 		map_cpu_to_node(lcpu, nid);
 		return nid;
 	}
@@ -1119,7 +1120,7 @@ void __init do_init_bootmem(void)
 	 */
 	setup_node_to_cpumask_map();
 
-	reset_numa_cpu_lookup_table();
+	reset_numa_cpu_node();
 	register_cpu_notifier(&ppc64_numa_nb);
 	cpu_numa_callback(&ppc64_numa_nb, CPU_UP_PREPARE,
 			  (void *)(unsigned long)boot_cpuid);
@@ -1518,7 +1519,7 @@ static int update_lookup_table(void *data)
 		base = cpu_first_thread_sibling(update->cpu);
 
 		for (j = 0; j < threads_per_core; j++) {
-			update_numa_cpu_lookup_table(base + j, nid);
+			update_numa_cpu_node(base + j, nid);
 		}
 	}
 
@@ -1571,7 +1572,7 @@ int arch_update_cpu_topology(void)
 		if (new_nid < 0 || !node_online(new_nid))
 			new_nid = first_online_node;
 
-		if (new_nid == numa_cpu_lookup_table[cpu]) {
+		if (new_nid == cpu_to_node(cpu)) {
 			cpumask_andnot(&cpu_associativity_changes_mask,
 					&cpu_associativity_changes_mask,
 					cpu_sibling_mask(cpu));
@@ -1583,7 +1584,7 @@ int arch_update_cpu_topology(void)
 			ud = &updates[i++];
 			ud->cpu = sibling;
 			ud->new_nid = new_nid;
-			ud->old_nid = numa_cpu_lookup_table[sibling];
+			ud->old_nid = cpu_to_node(sibling);
 			cpumask_set_cpu(sibling, &updated_cpus);
 			if (i < weight)
 				ud->next = &updates[i];

^ permalink raw reply related


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox