Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp4377073ybi; Tue, 11 Jun 2019 05:47:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqxzCPEkRyba5xR/xNmqqUjr+VTrv5Il8DS/5D3rwPK4l4GjuE6L4jlMlS4Puv64u8VrIEr0 X-Received: by 2002:a63:79c8:: with SMTP id u191mr1603196pgc.366.1560257245829; Tue, 11 Jun 2019 05:47:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560257245; cv=none; d=google.com; s=arc-20160816; b=A+7AdgwIeMc2xZTx/tox2He7lz/X+wlskCdKL1EWRAQvi33fSgNKAUY4P8V7Q+2ETg eGnwfX5Y34rDsfqgAztIxlCwSG2+3CBRSCnax095bfhDnietZvfVsI06sXyb5EOVTJbi 1zQX0juOE3DrwzuuhxKCQdxF6I7D9u8Yd2u8rTvddXll27nz6c/FOtS3MrfGhokuPAI/ XvNXeazPXUKWAsmNthDwJqCKTvX1968TP9s/k5V+LE+y2bX/tfIelhAC+iBnrBLukc2U EIe0FZaqi0mdXGJ1y2GmtxZvDS5b3Kgght9gk3NSQsRieEubj7uz4BE+V4LLy3jxd5CU lSsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version:dkim-signature; bh=ZpJoiyTHXYiF7kVWlp5BjDY7BKtjLiYkm/X37H4JtRA=; b=rI/AXvJ0UMmlONGZFq2t+GN3529ptBokX7l1SDvupxmNWnpIkKB4yFjppKR/wSUD14 BXG2u14vyAwA0pXomr8HYjjpUwuSI8TO9va3krWxUwpmmk9BbmG27lWD7TMD8ifMa9bO ZpCwsuUFN9y3M44ttZ5Ttvb+S0Gs41aa7gK1T7fiLNzabZNNftEs2f3FD/4FXP8GgGAK qOJbF8WH9lFL8Yn1LRTDeWF9Ewo7DPq6N3hME4sV7FSX9r7BLCHrsC57YpM+aWI7Xc2B jq21XG6RkmpVJefjZMTiz4qG7c+34/jjTfN2aROyAFBYYKHkoAhkv/xw2ivcfeu19pe9 MYqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b=hLRASOXJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w11si747319pjq.17.2019.06.11.05.47.09; Tue, 11 Jun 2019 05:47:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@lca.pw header.s=google header.b=hLRASOXJ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389076AbfFKMqu (ORCPT + 99 others); Tue, 11 Jun 2019 08:46:50 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:42727 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387593AbfFKMqt (ORCPT ); Tue, 11 Jun 2019 08:46:49 -0400 Received: by mail-qt1-f193.google.com with SMTP id s15so14262060qtk.9 for ; Tue, 11 Jun 2019 05:46:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lca.pw; s=google; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ZpJoiyTHXYiF7kVWlp5BjDY7BKtjLiYkm/X37H4JtRA=; b=hLRASOXJ6YWopQW2zJe/it1PtEXmPcjruiqSpyOQKa5oD3C8YF+KvSNFv+xPBPv8TH CzCRYOnzTi4MviZsxUxLvtnYX/SstM6qMHkP2ZjCGdKb4NOMo4OzomCUwM9AkZRJvLcY zBlSTNXp47ZYVck/lb2Vf8hj+ivWJlgzX8hHHfJACZXIAazfHU6t6bVEp/2MWe1uv3gW uyDUU1Pw4fo18A5CmdAe1aQn+1GjjYUMlwnvuYNfoWxQ+TfCNSVL8tW0FDAe57IqSIZl TCwTH4gLQ/iBsYni03TKMCwq5TPb+YwXTrsEGY4TugtM+wRkRbwhzTzCkT+wKtQlm0Df hqZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ZpJoiyTHXYiF7kVWlp5BjDY7BKtjLiYkm/X37H4JtRA=; b=Iic47W7IwVAsY0SxUEHfxG7tMfaQ1AnRPhMF7g38BDPehKWhEXsQeTTSQ2kgmgadph hjBQ+9Z4dJrJJTEL4jmLKQ6b0PFiPCYs5vece5xFiV8TqyS58h2tZ/7TrTeiZ/yuVseO eGvlGhElvqLbiLpElJUTebC764JRhhzqiQfI4sDA2S1ml20lJZirCiYfouoj+N6p7nQF bWlW9eZoZLDW0ZmjveZj1V2SZOCWyiaTN4Mzm1Q6ABtC3ihNKD5IwOLdQECcK2jhesxA GAKOfMa4iR/cNyMO/TNtXuXwFL1qjGJcGQ/uE7CF2hol4VYN/+aiufufUXVPzAqEBOMG /egA== X-Gm-Message-State: APjAAAVrg9IVGrmmMA2osBnwXgPh/8iCN5l9qnoRrNE9uWbrznfxO6st 5EdCvGSyArvohY/NOZurU0ySoA== X-Received: by 2002:a0c:95af:: with SMTP id s44mr33429845qvs.162.1560257207741; Tue, 11 Jun 2019 05:46:47 -0700 (PDT) Received: from [192.168.1.153] (pool-71-184-117-43.bstnma.fios.verizon.net. [71.184.117.43]) by smtp.gmail.com with ESMTPSA id s23sm6636182qtk.31.2019.06.11.05.46.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Jun 2019 05:46:46 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: [PATCH -next] arm64/mm: fix a bogus GFP flag in pgd_alloc() From: Qian Cai In-Reply-To: <20190611124118.GA4761@rapoport-lnx> Date: Tue, 11 Jun 2019 08:46:45 -0400 Cc: Mark Rutland , Will Deacon , Andrew Morton , catalin.marinas@arm.com, Linux Kernel Mailing List , mhocko@kernel.org, linux-mm@kvack.org, vdavydov.dev@gmail.com, hannes@cmpxchg.org, cgroups@vger.kernel.org, linux-arm-kernel@lists.infradead.org Content-Transfer-Encoding: quoted-printable Message-Id: <3F6E1B9F-3789-4648-B95C-C4243B57DA02@lca.pw> References: <1559656836-24940-1-git-send-email-cai@lca.pw> <20190604142338.GC24467@lakrids.cambridge.arm.com> <20190610114326.GF15979@fuggles.cambridge.arm.com> <1560187575.6132.70.camel@lca.pw> <20190611100348.GB26409@lakrids.cambridge.arm.com> <20190611124118.GA4761@rapoport-lnx> To: Mike Rapoport X-Mailer: Apple Mail (2.3445.104.11) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Jun 11, 2019, at 8:41 AM, Mike Rapoport wrote: >=20 > On Tue, Jun 11, 2019 at 11:03:49AM +0100, Mark Rutland wrote: >> On Mon, Jun 10, 2019 at 01:26:15PM -0400, Qian Cai wrote: >>> On Mon, 2019-06-10 at 12:43 +0100, Will Deacon wrote: >>>> On Tue, Jun 04, 2019 at 03:23:38PM +0100, Mark Rutland wrote: >>>>> On Tue, Jun 04, 2019 at 10:00:36AM -0400, Qian Cai wrote: >>>>>> The commit "arm64: switch to generic version of pte allocation" >>>>>> introduced endless failures during boot like, >>>>>>=20 >>>>>> kobject_add_internal failed for pgd_cache(285:chronyd.service) = (error: >>>>>> -2 parent: cgroup) >>>>>>=20 >>>>>> It turns out __GFP_ACCOUNT is passed to kernel page table = allocations >>>>>> and then later memcg finds out those don't belong to any cgroup. >>>>>=20 >>>>> Mike, I understood from [1] that this wasn't expected to be a = problem, >>>>> as the accounting should bypass kernel threads. >>>>>=20 >>>>> Was that assumption wrong, or is something different happening = here? >>>>>=20 >>>>>>=20 >>>>>> backtrace: >>>>>> kobject_add_internal >>>>>> kobject_init_and_add >>>>>> sysfs_slab_add+0x1a8 >>>>>> __kmem_cache_create >>>>>> create_cache >>>>>> memcg_create_kmem_cache >>>>>> memcg_kmem_cache_create_func >>>>>> process_one_work >>>>>> worker_thread >>>>>> kthread >>>>>>=20 >>>>>> Signed-off-by: Qian Cai >>>>>> --- >>>>>> arch/arm64/mm/pgd.c | 2 +- >>>>>> 1 file changed, 1 insertion(+), 1 deletion(-) >>>>>>=20 >>>>>> diff --git a/arch/arm64/mm/pgd.c b/arch/arm64/mm/pgd.c >>>>>> index 769516cb6677..53c48f5c8765 100644 >>>>>> --- a/arch/arm64/mm/pgd.c >>>>>> +++ b/arch/arm64/mm/pgd.c >>>>>> @@ -38,7 +38,7 @@ pgd_t *pgd_alloc(struct mm_struct *mm) >>>>>> if (PGD_SIZE =3D=3D PAGE_SIZE) >>>>>> return (pgd_t *)__get_free_page(gfp); >>>>>> else >>>>>> - return kmem_cache_alloc(pgd_cache, gfp); >>>>>> + return kmem_cache_alloc(pgd_cache, = GFP_PGTABLE_KERNEL); >>>>>=20 >>>>> This is used to allocate PGDs for both user and kernel pagetables = (e.g. >>>>> for the efi runtime services), so while this may fix the = regression, I'm >>>>> not sure it's the right fix. >>>>>=20 >>>>> Do we need a separate pgd_alloc_kernel()? >>>>=20 >>>> So can I take the above for -rc5, or is somebody else working on a = different >>>> fix to implement pgd_alloc_kernel()? >>>=20 >>> The offensive commit "arm64: switch to generic version of pte = allocation" is not >>> yet in the mainline, but only in the Andrew's tree and linux-next, = and I doubt >>> Andrew will push this out any time sooner given it is broken. >>=20 >> I'd assumed that Mike would respin these patches to implement and use >> pgd_alloc_kernel() (or take gfp flags) and the updated patches would >> replace these in akpm's tree. >>=20 >> Mike, could you confirm what your plan is? I'm happy to review/test >> updated patches for arm64. >=20 > Sorry for the delay, I'm mostly offline these days. >=20 > I wanted to understand first what is the reason for the failure. I've = tried > to reproduce it with qemu, but I failed to find a bootable = configuration > that will have PGD_SIZE !=3D PAGE_SIZE :( >=20 > Qian Cai, can you share what is your environment and the kernel = config? https://raw.githubusercontent.com/cailca/linux-mm/master/arm64.config # lscpu Architecture: aarch64 Byte Order: Little Endian CPU(s): 256 On-line CPU(s) list: 0-255 Thread(s) per core: 4 Core(s) per socket: 32 Socket(s): 2 NUMA node(s): 2 Vendor ID: Cavium Model: 1 Model name: ThunderX2 99xx Stepping: 0x1 BogoMIPS: 400.00 L1d cache: 32K L1i cache: 32K L2 cache: 256K L3 cache: 32768K NUMA node0 CPU(s): 0-127 NUMA node1 CPU(s): 128-255 Flags: fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics = cpuid asimdrdm # dmidecode Handle 0x0001, DMI type 1, 27 bytes System Information Manufacturer: HPE Product Name: Apollo 70 =20 Version: X1 Wake-up Type: Power Switch Family: CN99XX