Received: by 10.223.176.5 with SMTP id f5csp1330750wra; Fri, 9 Feb 2018 17:37:17 -0800 (PST) X-Google-Smtp-Source: AH8x2248MGM8F1ZApHBrnRv4w4/usE527uZU3tdoniT5CQaMfVn/q8UP44e4yRfDPzqQRxdW/q5a X-Received: by 2002:a17:902:ab85:: with SMTP id f5-v6mr4306055plr.199.1518226637314; Fri, 09 Feb 2018 17:37:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518226637; cv=none; d=google.com; s=arc-20160816; b=XpvcxeiYrVHigZ3hb7z0PsthaS07GDDPCl6HxJxyNyeu6g8mlATi1EyLEWvstiH9A6 4Zw8oXB2v/epRzUWbWl4l5DRLR6M5SrLv7cWQx9c5TL1/L+dWnCN9AV+fzVDKbZYzTeX huCTAlDX6Q+viju8UXONAj47Htn7IZxR9lheGO2PvPTblZYipr/bZrY0z3ThZ6EbE3NQ uTlu2ERY0q8durrcBHRf6zKIXLegpOYvaCEij3Yhe0L+zinTmvcylLNVS+No6yzyYzAW aSSQ/vckHGiuZhieBH0/M+Z86lOeItTuopUtoUHGJoyu5/HrGyuogUZvVTpwXHZ5/aM6 Tf4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=EXbHxDyzzggeEUNxQTpKJpuO9DlO/3tV2iQV5lznh+8=; b=WsJiwzhT2LNDv0kkmdvcfkqGux9C8DO/nInxPkPHsG/dWdQIJkIkJm0TLtay9chOLw ZYDowYp5S/GlZaEdxiRkAN3Nuj4A/uACs1mCYPXMvpJzOK7cSPpO402ZqdMko0MxwKGf Gj3YWAjCCQkoL84WiNFmu/ZVg2tA/+GTJKPIqu1VYbr+xgLPSgXSC0juRhT0REIJgVWz IGlzquFy3Ox40rNRSnEp3bL8D/44S5i9QaGPn8Kc6wHoewvgaMzDQNfqeDQeOCk3gccK E368urWRx+NOCsAk5MQPduEEhQu9NjSbDxjsnWXoFUmtnZkjYFl/u25scJwRAfEe6c3r 085w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fXQ2nXA/; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i6si2061388pgv.412.2018.02.09.17.37.03; Fri, 09 Feb 2018 17:37:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=fXQ2nXA/; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751343AbeBJBgR (ORCPT + 99 others); Fri, 9 Feb 2018 20:36:17 -0500 Received: from mail-pl0-f45.google.com ([209.85.160.45]:43522 "EHLO mail-pl0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751122AbeBJBgP (ORCPT ); Fri, 9 Feb 2018 20:36:15 -0500 Received: by mail-pl0-f45.google.com with SMTP id f4so2258717plr.10; Fri, 09 Feb 2018 17:36:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=EXbHxDyzzggeEUNxQTpKJpuO9DlO/3tV2iQV5lznh+8=; b=fXQ2nXA/YNK1pF7CwaFVon1PkeDo3uOraKOOGrkd6+2vm00JEdr4zGIgBjPhNlSelu DGioAkhnjI+OP8NPTTg6YgfHx3OS/iHXugJqwnb9X27Xtjy97tkg9umPmbZ+9J/RNudi nFfvbZ9+oQ/m1wkto9OK9nOlKYmWWHZIZNCzo9NyOPkO4I+uNDFcfqPvVt3myrqFnLGg i/muiCAjRo/1ph5o4P1pRhYXxQzW9i8tK6uKeIiYjOE7ouAD/Ly0jEOyVPA8rEE/Q5Aw s2v2nlYJSOxssY7Omxf5sWrI1IESlfi3RRT93mB6lJDu94vZRtJmLs17qn66WKvcKn09 hW4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=EXbHxDyzzggeEUNxQTpKJpuO9DlO/3tV2iQV5lznh+8=; b=qlMNOjqq4Q8eCZUcqccxiB4/ytfbT/8i5CtMnLcubUKTgRVjRaA+NRElFfB4KLTBgP 55UG2Bs/pRdPWwxu6NK5rpuxPsqkJGdsye8mtX7mkYpa192AfTK5SW8E83Wotv8GRktj a05hMghX46W0sGnnZsrGgGz0eStmjzGSZUYo2xTPRa5uncAsDFCBmZf9rQjlv5EEF2G3 xLAKAEJyiBR+8hc9rHINdgHA3QcYkhGECTQYBi+1cMC+nOhMUrHu6FFucTlCrDCTaqBS uTyp2w5an/Ex/YKQre7JKvuUVC+OfUQyNP8kuI3eStz6iBeIyfWIqmjZGeaVlWdKbToh WXYA== X-Gm-Message-State: APf1xPALIALwJdDOIBDbU11+qZfI6fRIE69Q85+pweZEs8KOQg73ivuu qGlt5Xdce5+B8l/4Yq7VG+0= X-Received: by 2002:a17:902:208:: with SMTP id 8-v6mr4273414plc.359.1518226574804; Fri, 09 Feb 2018 17:36:14 -0800 (PST) Received: from ast-mbp ([2620:10d:c090:180::1ab9]) by smtp.gmail.com with ESMTPSA id s5sm16205287pfg.29.2018.02.09.17.36.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Feb 2018 17:36:13 -0800 (PST) Date: Fri, 9 Feb 2018 17:36:11 -0800 From: Alexei Starovoitov To: Daniel Borkmann Cc: Li Zhijian , "ast@kernel.org" , "shuah@kernel.org" , "linux-kselftest@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "Li, Philip" , netdev@vger.kernel.org Subject: Re: [Resend] Question: kselftests: bpf/test_maps failed Message-ID: <20180210013610.hkeblyfx76r2hgzt@ast-mbp> References: <747824f6-4877-69fe-9f1d-f3c18fed6a01@intel.com> <40e0d564-cacb-7608-423e-eb85f5343521@iogearbox.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <40e0d564-cacb-7608-423e-eb85f5343521@iogearbox.net> User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 09, 2018 at 03:01:57PM +0100, Daniel Borkmann wrote: > On 02/09/2018 06:14 AM, Li Zhijian wrote: > > Hi > > > > INTEL 0-Day noticed that bpf/test_maps has different results at different platforms. > > when it fails, the details are like > > Sorry for the late reply and thanks for reporting! More below: > > > ------------------ > > ? 880 Failed to create hashmap key=16 value=131072 'Cannot allocate memory' > > ? 881 Failed to create hashmap key=8 value=32768 'Cannot allocate memory' > > ? 882 Failed to create hashmap key=8 value=131072 'Cannot allocate memory' > > ? 883 Failed to create hashmap key=16 value=32768 'Cannot allocate memory' > > ? 884 Failed to create hashmap key=8 value=16384 'Cannot allocate memory' > > ? 885 Failed to create hashmap key=16 value=16384 'Cannot allocate memory' > > ? 886 Failed to create hashmap key=8 value=65536 'Cannot allocate memory' > > ? 887 Failed to create hashmap key=16 value=131072 'Cannot allocate memory' > > ? 888 Failed to create hashmap key=16 value=32768 'Cannot allocate memory' > > ? 889 Failed to create hashmap key=16 value=65536 'Cannot allocate memory' > > ? 890 Failed to create hashmap key=8 value=65536 'Cannot allocate memory' > > ? 891 Failed to create hashmap key=8 value=131072 'Cannot allocate memory' > > ? 892 Failed to create hashmap key=8 value=131072 'Cannot allocate memory' > > ? 893 Failed to create hashmap key=16 value=32768 'Cannot allocate memory' > > ? 894 Failed to create hashmap key=8 value=16384 'Cannot allocate memory' > > ? 895 Failed to create hashmap key=8 value=131072 'Cannot allocate memory' > > ? 896 Failed to create hashmap key=16 value=8192 'Cannot allocate memory' > > ? 897 Failed to create hashmap key=8 value=32768 'Cannot allocate memory' > > ? 898 Failed to create hashmap key=16 value=8192 'Cannot allocate memory' > > ? 899 Failed to create hashmap key=8 value=262144 'Cannot allocate memory' > > ? 900 Failed to create hashmap key=8 value=262144 'Cannot allocate memory' > > ? 901 Failed to create hashmap key=8 value=262144 'Cannot allocate memory' > > ? 902 Failed to create hashmap key=16 value=262144 'Cannot allocate memory' > > ? 903 Failed to create hashmap key=8 value=262144 'Cannot allocate memory' > > ? 904 Failed to create hashmap key=8 value=262144 'Cannot allocate memory' > > ? 905 test_maps: test_maps.c:955: run_parallel: Assertion `status == 0' failed. > > ? 906 Aborted > > ? 907 not ok 1..3 selftests:? test_maps [FAIL] > > ------------------ > > > > After a simply looking at the code, looks it's related to the cpu number and system memory. > > > > below are the result under different platform > > 1. Good > > model: Sandy Bridge > > nr_node: 1 > > nr_cpu: 4 > > memory: 6G > > > > 2. Good > > model: qemu-system-x86_64 -enable-kvm > > nr_cpu: 2 > > memory: 4G > > > > 3. Bad > > model: Ivytown Ivy Bridge-EP > > nr_cpu: 48 > > memory: 64G > > > > 4. Bad > > model: Skylake > > nr_cpu: 104 > > memory: 64G > > > > I try to change the process number to 10 from 100, so it can pass at above Skylake(4) machine. > > ------------ > > lizhijian@haswell-OptiPlex-9020:~/lkp/linux/tools/testing/selftests/bpf$ git diff > > diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c > > index 040356e..b788ca1 100644 > > --- a/tools/testing/selftests/bpf/test_maps.c > > +++ b/tools/testing/selftests/bpf/test_maps.c > > @@ -960,7 +960,7 @@ static void test_map_stress(void) > > ?{ > > ??????? run_parallel(100, test_hashmap, NULL); > > ??????? run_parallel(100, test_hashmap_percpu, NULL); > > -?????? run_parallel(100, test_hashmap_sizes, NULL); > > +?????? run_parallel(10, test_hashmap_sizes, NULL); > > ??????? run_parallel(100, test_hashmap_walk, NULL); > > ? > > ??????? run_parallel(100, test_arraymap, NULL); > > Unless Alexei has some better idea, I think if the bpf_create_map() error in > the stress test is about ENOMEM, then we shouldn't fail hard via exit(), for > all other cases we should however. So probably makes sense to just check for > errno == ENOMEM in case of fd < 0 in test_hashmap_sizes() and then continue > to keep trying under stress. Feel free to send a patch, Li. that's probably good path for now. I also see that test_maps fails on freshly booted kernel with such assert, but then restarting test_maps again works and repeated runs succeed too. I suspect there is a deeper issue here related to memory allocation. Either slab or percpu allocator are behaving funky. It needs to be further debugged.