Message ID | 20230803101754.1149-1-thunder.leizhen@huaweicloud.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp1066482vqx; Thu, 3 Aug 2023 04:06:14 -0700 (PDT) X-Google-Smtp-Source: APBJJlGrVKKDoJC80D5RjkNLGJMjARe6a+ehg+jSATJHs3mfdrip/brDqhLWF6tokREpKL/sy7ey X-Received: by 2002:a05:6a00:3a23:b0:687:2e26:9ca9 with SMTP id fj35-20020a056a003a2300b006872e269ca9mr16322287pfb.11.1691060773621; Thu, 03 Aug 2023 04:06:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691060773; cv=none; d=google.com; s=arc-20160816; b=kK/Igj5GBtJDJDyK4JexZ3YcCX0ddUZPDEA62/cT2nbaWf0dsgKpFgZwAMWBcIpw19 W31xUlZ5992kbsL/RrOaxtWRI0+gv1QEAUVV4g5QSdSBNWtMJJ7yw6qnefUFrScg8dK2 KyzB3/ce9C5Ff6DiNF73qcsM16d519MtxY6vQ/LbQ5T5XUL26Di+U5oOuJp89TvUHDCX z8yyHKiatN3jSVVv5C1pOxrPRFjHuJpgmwZsf0KjgLDVgbEXugfn5oML1S7Abhb7PGVN VUSkZ8GgMCLTIuWnFCT8BQeHTNHS1I77uQs4eL9KoOuLgDhctJc13+MyfcvRk6agd56a RDCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=ZoWetTvd2uES20v+6GvpE2bcg7uvaQqPOX/fZrBZzSM=; fh=ixpq6thPVOOZuciljZRZ5gp6/ROsGXjbN7hNRM43S+c=; b=Pmu8TcgeXubLYedtNJS5BufFmwPGupOZgKHYWS0F9t79RYgj2yan6NnjBprYfe6E+n 66JzJTazhifZBvrlrDPi93vaKoNgVLmO+HYD5TrHtbAUWRVwRytjKa5Rjpa51aNOgHnq kIO2FW9RdKUYxymmcL3yByVXj9+I78MJ+EGouT/kk8oNGq6k3nlJn/30Vgx0vrsbHq3D V3eweaBhoiznUrGZGMB85AYaFQrownFBtHYD7d7KJ42F4U6OyqOpRp5ORWzrXvBbBafD zbajp7tcP1L4IW6IQrTQeJDbQG/ME5/rFnHi1CeaNcyPtkbLcJs4vZJA+s54pSsJTD95 pxCQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p25-20020a056a0026d900b00686b9aacd65si12365949pfw.26.2023.08.03.04.06.00; Thu, 03 Aug 2023 04:06:13 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235399AbjHCKTg (ORCPT <rfc822;jeff.pang.chn@gmail.com> + 99 others); Thu, 3 Aug 2023 06:19:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52678 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235292AbjHCKTL (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 3 Aug 2023 06:19:11 -0400 Received: from dggsgout11.his.huawei.com (unknown [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4198F3A86; Thu, 3 Aug 2023 03:19:09 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.143]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4RGlF53Jt0z4f4TJc; Thu, 3 Aug 2023 18:19:05 +0800 (CST) Received: from huaweicloud.com (unknown [10.174.178.55]) by APP4 (Coremail) with SMTP id gCh0CgD3mp4Uf8tk4+TaPQ--.35755S4; Thu, 03 Aug 2023 18:19:04 +0800 (CST) From: thunder.leizhen@huaweicloud.com To: Christoph Lameter <cl@linux.com>, Pekka Enberg <penberg@kernel.org>, David Rientjes <rientjes@google.com>, Joonsoo Kim <iamjoonsoo.kim@lge.com>, Andrew Morton <akpm@linux-foundation.org>, Vlastimil Babka <vbabka@suse.cz>, Roman Gushchin <roman.gushchin@linux.dev>, Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-mm@kvack.org, "Paul E . McKenney" <paulmck@kernel.org>, Frederic Weisbecker <frederic@kernel.org>, Neeraj Upadhyay <quic_neeraju@quicinc.com>, Joel Fernandes <joel@joelfernandes.org>, Josh Triplett <josh@joshtriplett.org>, Boqun Feng <boqun.feng@gmail.com>, Steven Rostedt <rostedt@goodmis.org>, Mathieu Desnoyers <mathieu.desnoyers@efficios.com>, Lai Jiangshan <jiangshanlai@gmail.com>, Zqiang <qiang.zhang1211@gmail.com>, rcu@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Zhen Lei <thunder.leizhen@huawei.com> Subject: [PATCH v5 0/3] rcu: Dump memory object info if callback function is invalid Date: Thu, 3 Aug 2023 18:17:51 +0800 Message-Id: <20230803101754.1149-1-thunder.leizhen@huaweicloud.com> X-Mailer: git-send-email 2.37.3.windows.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID: gCh0CgD3mp4Uf8tk4+TaPQ--.35755S4 X-Coremail-Antispam: 1UD129KBjvJXoW7ZFWfuw1Utr4rArykAr43KFg_yoW8WrWUpw nxW3sxWry5Ary3CF13ZF1IkrW5Ga18JFsIk3ZxZw18u3Wjvr97uFykJr1IqF9xGF93KF1U ta1YkF1jkw45ArDanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvYb4IE77IF4wAFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6r1S6rWUM7CIcVAFz4kK6r1j6r18M28lY4IEw2IIxxk0rwA2F7IY1VAKz4 vEj48ve4kI8wA2z4x0Y4vE2Ix0cI8IcVAFwI0_tr0E3s1l84ACjcxK6xIIjxv20xvEc7Cj xVAFwI0_Gr1j6F4UJwA2z4x0Y4vEx4A2jsIE14v26rxl6s0DM28EF7xvwVC2z280aVCY1x 0267AKxVW0oVCq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG 6I80ewAv7VC0I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFV Cjc4AY6r1j6r4UM4x0Y48IcxkI7VAKI48JM4IIrI8v6xkF7I0E8cxan2IY04v7M4kE6xkI j40Ew7xC0wCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F4 0E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_GFv_Wryl IxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7CjxV AFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6rWUJVWrZr1UMIIF0xvEx4A2jsIE14v2 6r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf9x07 UKfO7UUUUU= X-CM-SenderInfo: hwkx0vthuozvpl2kv046kxt4xhlfz01xgou0bp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,MAY_BE_FORGED, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773088810889479563 X-GMAIL-MSGID: 1773205741901766800 |
Series |
rcu: Dump memory object info if callback function is invalid
|
|
Message
Leizhen (ThunderTown)
Aug. 3, 2023, 10:17 a.m. UTC
From: Zhen Lei <thunder.leizhen@huawei.com>
v4 --> v5:
1. Add Reviewed-by Acked-by for patch 1/3
2. Add patch 3/3:
mm: Dump the memory of slab object in kmem_dump_obj()
v3 --> v4:
1. Remove kmem_valid_obj() and convert kmem_dump_obj() to work the same way
as vmalloc_dump_obj().
2. In kernel/rcu/rcu.h
-#include <linux/mm.h>
+#include <linux/slab.h>
v2 --> v3:
1. I made statistics about the source of 'rhp'. kmem_valid_obj() accounts for
more than 97.5%, and vmalloc accounts for less than 1%. So change call
mem_dump_obj() to call kmem_dump_obj() can meet debugging requirements and
avoid the potential deadlock risk of vmalloc_dump_obj().
- mem_dump_obj(rhp);
+ if (kmem_valid_obj(rhp))
+ kmem_dump_obj(rhp);
The discussion about vmap_area_lock deadlock in v2:
https://lkml.org/lkml/2022/11/11/493
2. Provide static inline empty functions for kmem_valid_obj() and kmem_dump_obj()
when CONFIG_PRINTK=n.
v1 --> v2:
1. Remove condition "(unsigned long)rhp->func & 0x3", it have problems on x86.
2. Paul E. McKenney helped me update the commit message, thanks.
Zhen Lei (3):
mm: Remove kmem_valid_obj()
rcu: Dump memory object info if callback function is invalid
mm: Dump the memory of slab object in kmem_dump_obj()
include/linux/slab.h | 5 +--
kernel/rcu/rcu.h | 7 +++++
kernel/rcu/srcutiny.c | 1 +
kernel/rcu/srcutree.c | 1 +
kernel/rcu/tasks.h | 1 +
kernel/rcu/tiny.c | 1 +
kernel/rcu/tree.c | 1 +
mm/slab_common.c | 71 +++++++++++++++++++++++--------------------
mm/util.c | 4 +--
9 files changed, 54 insertions(+), 38 deletions(-)