Received: by 2002:a5d:925a:0:0:0:0:0 with SMTP id e26csp84201iol; Wed, 8 Jun 2022 22:40:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJye1Pr3mrEFRCiZnKkRq9ML5WdfI8pgLQXcRv53AkWmy8qseabdcTOAN/rSzLnKXaspSIEg X-Received: by 2002:a17:903:40c9:b0:167:5411:3536 with SMTP id t9-20020a17090340c900b0016754113536mr28623819pld.2.1654753255048; Wed, 08 Jun 2022 22:40:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654753255; cv=none; d=google.com; s=arc-20160816; b=VKu69mM4uIVh1sLMDeBJpEDHKKPHO4KsixG9k4CgwNJBOpCJLApG7izlicS++vQZWQ IdA0MSCH3hLKZONhMDViH6j1PIUfkyE4XuaDOYkRildKc1xqKWdhf0s1As2i0eLFJh1f GSttQr0KZ/pi7JwnVy2TjohVkg82cozmSKrLYAcXTdBmcNDZ32Z2yd074HKyz+vpnlbo I9CQpvbkAtVoshotjLm0bc7WUieZKH0pILt+xhadyQDzvT5eKHhbkTP0rglR1fxLGi9R u3bJ5fa1E8zZpS2sAGxGRhawGTtlIDOH7ztxa5YsDDZ5aL7MAlKzQTG/8BL1hmZe7xtm ZSAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id; bh=cdoYznewMCUcfIRQafixlSX0FRu+V1Fle1rBghjEbWc=; b=zaBrD8grQk3jGaUi76VTN0kgAizhsbNKFoUI9p/dMdrNfpCxdhwKqNh8fn8LJWoZmY or/AT5JWGUf4CcMwQYlHrRzLSNPfxzmGH7/mMWrWTYHZ8y6O2Xwj6sgniRM4/0ivOXUz 0a0G9uiD3v3lVJ3ZjM+82zkshCjcz/ptTlJPn/ZBR6iG0J403CK/m8tZIOxbxROkERP1 9VwjFqdj3uGygDeZ5e8OWZ3EC26BRj8wIF+b5k05OAU+CHokLxp2c4FodIZAVtTJYJkk PmumIWH6NeIzpe95irWVo42lZ+i/Edw7Yt4wLruVzUV+eU/RuCsofbXdioyB8ql3ar0v EbOQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n5-20020a170902e54500b0015ec40a4136si33069585plf.438.2022.06.08.22.40.43; Wed, 08 Jun 2022 22:40:55 -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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237830AbiFIEnI (ORCPT + 99 others); Thu, 9 Jun 2022 00:43:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237848AbiFIEnF (ORCPT ); Thu, 9 Jun 2022 00:43:05 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 98F2D22369E; Wed, 8 Jun 2022 21:43:03 -0700 (PDT) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4LJWf26nYGzjX3f; Thu, 9 Jun 2022 12:42:02 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 9 Jun 2022 12:43:01 +0800 Received: from [10.174.177.243] (10.174.177.243) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Thu, 9 Jun 2022 12:43:00 +0800 Message-ID: <6763271f-6f65-b83a-6892-dbd502368f5e@huawei.com> Date: Thu, 9 Jun 2022 12:43:00 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [next] arm64: boot failed - next-20220606 Content-Language: en-US From: Kefeng Wang To: Vasily Averin , Naresh Kamboju , Shakeel Butt , Linux ARM CC: Stephen Rothwell , Linux-Next Mailing List , open list , , , linux-mm , Andrew Morton , "Ard Biesheuvel" , Arnd Bergmann , Catalin Marinas , Raghuram Thammiraju , Mark Brown , Will Deacon , "Roman Gushchin" , Qian Cai References: <20220607162504.7fd5a92a@canb.auug.org.au> <2a4cc632-c936-1e42-4fdc-572334c58ee1@openvz.org> <44530040-0384-796e-143f-b7293886753c@huawei.com> In-Reply-To: <44530040-0384-796e-143f-b7293886753c@huawei.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.174.177.243] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500001.china.huawei.com (7.185.36.107) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,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 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.