From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yonghong Song Subject: [PATCH bpf-next 0/3] bpf: add bpffs pretty print for hash/lru_hash maps Date: Thu, 9 Aug 2018 08:55:18 -0700 Message-ID: <20180809155521.1544888-1-yhs@fb.com> Mime-Version: 1.0 Content-Type: text/plain Cc: To: , , Return-path: Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:38864 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730880AbeHISVA (ORCPT ); Thu, 9 Aug 2018 14:21:00 -0400 Received: from pps.filterd (m0044012.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w79Ft2vt024676 for ; Thu, 9 Aug 2018 08:55:29 -0700 Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2krng5ghhf-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Thu, 09 Aug 2018 08:55:29 -0700 Sender: netdev-owner@vger.kernel.org List-ID: Commit a26ca7c982cb ("bpf: btf: Add pretty print support to the basic arraymap") added pretty print support to array map. This patch adds pretty print for hash and lru_hash maps. The following example shows the pretty-print result of a pinned hashmap. Without this patch set, user will get an error instead. struct map_value { int count_a; int count_b; }; cat /sys/fs/bpf/pinned_hash_map: 87907: {87907,87908} 57354: {37354,57355} 76625: {76625,76626} ... Patch #1 fixed a bug in bpffs map_seq_next() function so that all elements in the hash table will be traversed. Patch #2 implemented map_seq_show_elem() and map_check_btf() callback functions for hash and lru hash maps. Patch #3 enhanced tools/testing/selftests/bpf/test_btf.c to test bpffs hash and lru hash map pretty print. Yonghong Song (3): bpf: fix bpffs non-array map seq_show issue bpf: btf: add pretty print for hash/lru_hash maps tools/bpf: add bpffs pretty print btf test for hash/lru_hash maps kernel/bpf/hashtab.c | 44 +++++++++++++++++ kernel/bpf/inode.c | 8 ++-- tools/testing/selftests/bpf/test_btf.c | 87 ++++++++++++++++++++++++++++------ 3 files changed, 121 insertions(+), 18 deletions(-) -- 2.14.3