From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 50AFEC43334 for ; Thu, 9 Jun 2022 05:21:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=AcmTzaQtiodeUeeC+lyMukdCQiM+07MnVkHEj7HHnTo=; b=nRKZnDKgLqta4r 7JBwvmRUnFkzvz+2AhhRgWi02+OHeEk8mSjX7V2g45ylV0Hi4cUcAcJkHD9zVbWJv89uWLTLtED2Z UZsKyg4fOTnLVpRtKi0eXy+b8dFtwIDJBnnE1opw4X8hmcnXrFQa5Df8NES8vko/XpcUqFZ7BcqvP 8dAdblUuERh2TUaMEY39+bBQ7YTcVix23dH+A5TdnRhHMMygw+6nO3fV47kpLdtQK5TUkI+rnAUN8 Wehvlps+DZboN+vyQQBdTWeH6D8X4xX7ZK0zN3dX+eQR8CPplU7HUD9BdV6yvfHRZHaHzAbCaDfvG aI+dL5YaxWA9L6R3gzwA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nzAaG-00GogZ-Pp; Thu, 09 Jun 2022 05:19:52 +0000 Received: from out2.migadu.com ([2001:41d0:2:aacc::]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nzAaC-00GoeX-I1 for linux-arm-kernel@lists.infradead.org; Thu, 09 Jun 2022 05:19:50 +0000 Date: Wed, 8 Jun 2022 22:19:32 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1654751982; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=6DZpV+uN4f8trR7cow66ys5/tS3rIS+dNuOhVPIRE2k=; b=W9bp2FmIJi7K+/8TUdK5q7lcneNLnYwU6QHv0HLZeKir4zoJeheew3c5M1dYeCArwMNBpf SPPIafp8RWt82YGZWJGk2UBT6UTR3iNh12GFBOuAG9F37WUD2Ukm0TF8mgJ5bNOceGPbur WzH074nFiKk3BXw25D/s+lLq0ZlzIVM= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Kefeng Wang Cc: Vasily Averin , Naresh Kamboju , Shakeel Butt , Linux ARM , Stephen Rothwell , Linux-Next Mailing List , open list , regressions@lists.linux.dev, lkft-triage@lists.linaro.org, linux-mm , Andrew Morton , Ard Biesheuvel , Arnd Bergmann , Catalin Marinas , Raghuram Thammiraju , Mark Brown , Will Deacon , Qian Cai Subject: Re: [next] arm64: boot failed - next-20220606 Message-ID: References: <20220607162504.7fd5a92a@canb.auug.org.au> <2a4cc632-c936-1e42-4fdc-572334c58ee1@openvz.org> <44530040-0384-796e-143f-b7293886753c@huawei.com> <6763271f-6f65-b83a-6892-dbd502368f5e@huawei.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <6763271f-6f65-b83a-6892-dbd502368f5e@huawei.com> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220608_221949_074919_58693959 X-CRM114-Status: GOOD ( 30.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Jun 09, 2022 at 12:43:00PM +0800, Kefeng Wang wrote: > = > On 2022/6/9 11:44, Kefeng Wang wrote: > > = > > On 2022/6/9 10:49, Vasily Averin wrote: > > > Dear ARM developers, > > > could you please help me to find the reason of this problem? > > Hi, > > > mem_cgroup_from_obj(): > > > ffff80000836cf40:=A0=A0=A0=A0=A0=A0 d503245f=A0=A0=A0=A0=A0=A0=A0 bti= =A0=A0=A0=A0 c > > > ffff80000836cf44:=A0=A0=A0=A0=A0=A0 d503201f=A0=A0=A0=A0=A0=A0=A0 nop > > > ffff80000836cf48:=A0=A0=A0=A0=A0=A0 d503201f=A0=A0=A0=A0=A0=A0=A0 nop > > > ffff80000836cf4c:=A0=A0=A0=A0=A0=A0 d503233f=A0=A0=A0=A0=A0=A0=A0 pac= iasp > > > ffff80000836cf50:=A0=A0=A0=A0=A0=A0 d503201f=A0=A0=A0=A0=A0=A0=A0 nop > > > ffff80000836cf54:=A0=A0=A0=A0=A0=A0 d2e00021=A0=A0=A0=A0=A0=A0=A0 mov= =A0=A0=A0=A0 x1, > > > #0x1000000000000=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 // #281474976710656 > > > ffff80000836cf58:=A0=A0=A0=A0=A0=A0 8b010001=A0=A0=A0=A0=A0=A0=A0 add= =A0=A0=A0=A0 x1, x0, x1 > > > ffff80000836cf5c:=A0=A0=A0=A0=A0=A0 b25657e4=A0=A0=A0=A0=A0=A0=A0 mov= =A0=A0=A0=A0 x4, > > > #0xfffffc0000000000=A0=A0=A0=A0=A0=A0=A0=A0 // #-4398046511104 > > > ffff80000836cf60:=A0=A0=A0=A0=A0=A0 d34cfc21=A0=A0=A0=A0=A0=A0=A0 lsr= =A0=A0=A0=A0 x1, x1, #12 > > > ffff80000836cf64:=A0=A0=A0=A0=A0=A0 d37ae421=A0=A0=A0=A0=A0=A0=A0 lsl= =A0=A0=A0=A0 x1, x1, #6 > > > ffff80000836cf68:=A0=A0=A0=A0=A0=A0 8b040022=A0=A0=A0=A0=A0=A0=A0 add= =A0=A0=A0=A0 x2, x1, x4 > > > ffff80000836cf6c:=A0=A0=A0=A0=A0=A0 f9400443=A0=A0=A0=A0=A0=A0=A0 ldr= =A0=A0=A0=A0 x3, [x2, #8] > > > = > > > x5 : ffff80000a96f000 x4 : fffffc0000000000 x3 : ffff80000ad5e680 > > > x2 : fffffe00002bc240 x1 : 00000200002bc240 x0 : ffff80000af09740 > > > = > > > x0 =3D 0xffff80000af09740 is an argument of mem_cgroup_from_obj() > > > according to System.map it is init_net > > > = > > > This issue is caused by calling virt_to_page() on address of static > > > variable init_net. > > > Arm64 consider that addresses of static variables are not valid > > > virtual addresses. > > > On x86_64 the same API works without any problem. > > > = > > > Unfortunately I do not understand the cause of the problem. > > > I do not see any bugs in my patch. > > > I'm using an existing API, mem_cgroup_from_obj(), to find the memory > > > cgroup used > > > to account for the specified object. > > > In particular, in the current case, I wanted to get the memory > > > cgroup of the > > > specified network namespace by the name taken from for_each_net(). > > > The first object in this list is the static structure unit_net > > = > > root@test:~# cat /proc/kallsyms |grep -w _data > > ffff80000a110000 D _data > > root@test:~# cat /proc/kallsyms |grep -w _end > > ffff80000a500000 B _end > > root@test:~# cat /proc/kallsyms |grep -w init_net > > ffff80000a4eb980 B init_net > > = > > the init_net is located in data section, on arm64, it is allowed by > > vmalloc, see > > = > > =A0=A0=A0 map_kernel_segment(pgdp, _data, _end, PAGE_KERNEL, &vmlinux_d= ata, 0, > > 0); > > = > > and the arm has same behavior. > > = > > We could let init_net be allocated dynamically, but I think it could > > change a lot. > > = > > Any better sugguestion, Catalin? > = > or=A0 add vmalloc check in mem_cgroup_from_obj()? > = > diff --git a/mm/memcontrol.c b/mm/memcontrol.c > index 27cebaa53472..fb817e5da5f0 100644 > --- a/mm/memcontrol.c > +++ b/mm/memcontrol.c > @@ -2860,7 +2860,10 @@ struct mem_cgroup *mem_cgroup_from_obj(void *p) > =A0=A0=A0=A0=A0=A0=A0 if (mem_cgroup_disabled()) > =A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 return NULL; > = > -=A0=A0=A0=A0=A0=A0 folio =3D virt_to_folio(p); > +=A0=A0=A0=A0=A0=A0 if (unlikely(is_vmalloc_addr(p))) > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 folio =3D page_folio(vmalloc_= to_page(p)); > +=A0=A0=A0=A0=A0=A0 else > +=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 folio =3D virt_to_folio(p); > = > =A0=A0=A0=A0=A0=A0=A0 /* > =A0=A0=A0=A0=A0=A0=A0=A0 * Slab objects are accounted individually, not p= er-page. > = It sounds right. Later we can add something like mem_cgroup_from_slab_obj() to use on hot paths and avoid this check. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel