Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp76591iol; Wed, 8 Jun 2022 22:26:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzklj2ZqJpRiAvba15sj6Jm+3p1N+THfIF9aR+JFzFX77EWOAHkT4px4gvLJ+thNPzs+iKy X-Received: by 2002:a17:906:2806:b0:70d:ed7a:ca5b with SMTP id r6-20020a170906280600b0070ded7aca5bmr29622697ejc.173.1654752405033; Wed, 08 Jun 2022 22:26:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654752405; cv=none; d=google.com; s=arc-20160816; b=MKOGiFqXNx1mS33nZjWF6UOUo83/VGw3PbGnLB5HBhkghXtmRzZK1ThA4M8hX0Td3Z YV165PpIvjtqEsaA2CPLzdnFFIH//iugE+Opvrxonh6v6JSWciofzS8QwNnra5Pko7Wa /QgLomszvFO0Lnst8xXsD2hTg4rIowd3ImmUcSdyO3SDq+UDA55TZyNM5rjJy4YvzJfs OCLB+iQYjoo+gLrJMFMF25JBriXD5XWp1bYwJZocCkqUmCPwjSxhvKkG8AZ9QhKKZXxx M0wqS/9mJ1hU0cdT6aDzYB1lMny4hVEeZhHnN7YdxFOtLk6nk7Ukg9Aflozw0nbyVeKk up0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:dkim-signature:date; bh=6DZpV+uN4f8trR7cow66ys5/tS3rIS+dNuOhVPIRE2k=; b=HZ3ZJihYP4jVvOrXKaMkPrL7qtSAqZY5KVDxTeyA1cYtgM8ubGXo0Dhm23zE6gBn57 ZAOvHDfgIVT4da2rCv7gpxLH91oUiVF/81LSGXsgUNleb3+aUfgwcUosdD86PO36lL2+ FdS1ahxpAfZcrflLcwqkBkDdA6XOFCEzFQVVnnqT5Yh8U/Cz1Y6WAI2oAbhg3+oAiiYj dZPxqwCo311PybtHMkCTXY+0jUSKIRK/nO/xPXiVuBHTIruQDuDuaizYQ2UkWIji0EJu gwKOB6+DkY3pu9Mfm6ow347XAUgwMx8QnQcg+8CX3wn8QgJbMREx//gBcS5adFuXrRHQ Tj5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=W9bp2FmI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e5-20020a17090658c500b0070d84d3b710si2341676ejs.673.2022.06.08.22.26.19; Wed, 08 Jun 2022 22:26:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=W9bp2FmI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231128AbiFIFTt (ORCPT + 99 others); Thu, 9 Jun 2022 01:19:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232431AbiFIFTq (ORCPT ); Thu, 9 Jun 2022 01:19:46 -0400 Received: from out2.migadu.com (out2.migadu.com [IPv6:2001:41d0:2:aacc::]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB97F28ABFC; Wed, 8 Jun 2022 22:19:44 -0700 (PDT) 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-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <6763271f-6f65-b83a-6892-dbd502368f5e@huawei.com> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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:?????? d503245f??????? bti???? c > > > ffff80000836cf44:?????? d503201f??????? nop > > > ffff80000836cf48:?????? d503201f??????? nop > > > ffff80000836cf4c:?????? d503233f??????? paciasp > > > ffff80000836cf50:?????? d503201f??????? nop > > > ffff80000836cf54:?????? d2e00021??????? mov???? x1, > > > #0x1000000000000??????????? // #281474976710656 > > > ffff80000836cf58:?????? 8b010001??????? add???? x1, x0, x1 > > > ffff80000836cf5c:?????? b25657e4??????? mov???? x4, > > > #0xfffffc0000000000???????? // #-4398046511104 > > > ffff80000836cf60:?????? d34cfc21??????? lsr???? x1, x1, #12 > > > ffff80000836cf64:?????? d37ae421??????? lsl???? x1, x1, #6 > > > ffff80000836cf68:?????? 8b040022??????? add???? x2, x1, x4 > > > ffff80000836cf6c:?????? f9400443??????? ldr???? x3, [x2, #8] > > > > > > x5 : ffff80000a96f000 x4 : fffffc0000000000 x3 : ffff80000ad5e680 > > > x2 : fffffe00002bc240 x1 : 00000200002bc240 x0 : ffff80000af09740 > > > > > > x0 = 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 > > > > ??? map_kernel_segment(pgdp, _data, _end, PAGE_KERNEL, &vmlinux_data, 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? 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) > ??????? if (mem_cgroup_disabled()) > ??????????????? return NULL; > > -?????? folio = virt_to_folio(p); > +?????? if (unlikely(is_vmalloc_addr(p))) > +?????????????? folio = page_folio(vmalloc_to_page(p)); > +?????? else > +?????????????? folio = virt_to_folio(p); > > ??????? /* > ???????? * Slab objects are accounted individually, not per-page. > It sounds right. Later we can add something like mem_cgroup_from_slab_obj() to use on hot paths and avoid this check.