From patchwork Tue Oct 18 07:10:10 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balbir Singh X-Patchwork-Id: 683556 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3symTS1pfjz9ryv for ; Tue, 18 Oct 2016 18:11:40 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=Yor16TGo; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3symTS0llrzDvRg for ; Tue, 18 Oct 2016 18:11:40 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=Yor16TGo; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from ozlabs.org (ozlabs.org [103.22.144.67]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3symRs3ZgQzDrPG for ; Tue, 18 Oct 2016 18:10:17 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=Yor16TGo; dkim-atps=neutral Received: by ozlabs.org (Postfix) id 3symRs2tP8z9sC7; Tue, 18 Oct 2016 18:10:17 +1100 (AEDT) Delivered-To: linuxppc-dev@ozlabs.org Received: from mail-pf0-x242.google.com (mail-pf0-x242.google.com [IPv6:2607:f8b0:400e:c00::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3symRr5lKjz9sBr for ; Tue, 18 Oct 2016 18:10:16 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=Yor16TGo; dkim-atps=neutral Received: by mail-pf0-x242.google.com with SMTP id r16so14360112pfg.3 for ; Tue, 18 Oct 2016 00:10:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=to:subject:from:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=Vd6STgHFGdYs3QwSPkGo1dLSObeiovcoZu7ups8lDlU=; b=Yor16TGoTrEwPHZCdOyDUMq3uCvYoGi0X/L9I7W65mEeWyYudq7efqZwhJhRvaJJIf xyFPX3gnr6MI+SjaEIdcbTJ9rfJgi/jYi0rxcShLTRjQ0AIb4a7c2jL89kDnx9yUFnyB IXSJIuaHViOaAhTxvubg23vOW2sUhJbTHxMopP0rjHLwfNR3DNtcnpYmTN7RBHzXwqol wyO78r6KTMs/8pXXrK9+WKsAl76h+S2lOj96MY6l02Qi1+U/pf5QUCkCUzDE9F5LVFJy UgXy4EOAmaiPzdnrnPdmMZ1W9bCFidFPeeDUWjOHCa62eDvgySj8UZQG8rlTkCOXPawo hXyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:to:subject:from:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=Vd6STgHFGdYs3QwSPkGo1dLSObeiovcoZu7ups8lDlU=; b=W9TZsPBxJvCEWj9WscWrHYb+eOkcFQJvzptjL9dvdXwaNT1BUDAojKgFO/CR2vrSz7 +j/qvgvTVZvH/c8p8FV18/0N7G/fBx7i45z6B2PmYTrzaC1AyISBOnCY1uUnS4aFK45J RvlA+mdyt124JeiKv2wdUzuTsswKGjYBzJ7c4lamxcBCPxElnMJXKXynK7/PFLiFmvug z+UFVCgCgNiaQ+DrY5OFapI0UmiqkLf6hT39S/Y365w/lfA4JBZ0rbc6m0dYw8B0Q04T IiH7a8chKczr/Zh4wp3TlteUVG8T3k5nmxKZ1eOvEX2kW6tDgZdFW9dg27k9gjKo6jzJ WB/g== X-Gm-Message-State: AA6/9RkCCFS8O+xvER4JEKTvmjbuIoWSGCppXfKIck+npAq5yx7gLVPIiqE8fH1efnau8A== X-Received: by 10.98.31.4 with SMTP id f4mr2186291pff.67.1476774614397; Tue, 18 Oct 2016 00:10:14 -0700 (PDT) Received: from balbir.ozlabs.ibm.com ([122.99.82.10]) by smtp.gmail.com with ESMTPSA id cp2sm20562238pad.3.2016.10.18.00.10.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Oct 2016 00:10:13 -0700 (PDT) To: Michael Ellerman , linuxppc-dev Subject: [PATCH] Setup per-cpu cpu<->node binding early From: Balbir Singh Message-ID: <1c7ad577-da11-e4a5-b5b0-16ce2da6f67c@gmail.com> Date: Tue, 18 Oct 2016 18:10:10 +1100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" Michael Ellerman debugged an issue w.r.t workqueue changes (see https://lkml.org/lkml/2016/10/17/352) down to the fact that we don't setup our per cpu (cpu to node) binding early enough (in setup_per_cpu_areas like x86 does). This lead to a problem with workqueue changes where the cpus seen by for_each_node() in workqueue_init_early() was different from their binding seen later in for_each_possible_cpu(cpu) { node = cpu_to_node(cpu) ... } In setup_arch()->initmem_init() we have access to the binding in numa_cpu_lookup_table() This patch implements Michael's suggestion of setting up the per cpu node binding inside of setup_per_cpu_areas() I did not remove the original setting of these values from smp_prepare_cpus(). I've also not setup per cpu mem's via set_cpu_numa_mem() since zonelists are not yet built by the time we do per cpu setup. Reported-by: Michael Ellerman Signed-off-by: Balbir Singh --- arch/powerpc/kernel/setup_64.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index c3e1290..842415a 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c @@ -625,6 +625,8 @@ void __init setup_per_cpu_areas(void) for_each_possible_cpu(cpu) { __per_cpu_offset[cpu] = delta + pcpu_unit_offsets[cpu]; paca[cpu].data_offset = __per_cpu_offset[cpu]; + + set_cpu_numa_node(cpu, numa_cpu_lookup_table[cpu]); } } #endif