From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5D0DCC3DA7F for ; Fri, 26 Jul 2024 12:27:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AF9EB6B009D; Fri, 26 Jul 2024 08:27:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AA6BC6B009E; Fri, 26 Jul 2024 08:27:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 91FCC6B00A0; Fri, 26 Jul 2024 08:27:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 7143F6B009D for ; Fri, 26 Jul 2024 08:27:13 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 230EC1A180B for ; Fri, 26 Jul 2024 12:27:13 +0000 (UTC) X-FDA: 82381828746.09.8385818 Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) by imf24.hostedemail.com (Postfix) with ESMTP id 2438F18000F for ; Fri, 26 Jul 2024 12:27:10 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=KuK435nG; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of olsajiri@gmail.com designates 209.85.218.43 as permitted sender) smtp.mailfrom=olsajiri@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1721996794; a=rsa-sha256; cv=none; b=dwUjEXdqDFNaCRqxf+RnF6OD4qM+AQ0zo8UY2+S5k0/E62JNmmoB269KcYjqLCyjxLgaw9 tZPzuBXRgy48kJwDgWZJWh7lswYollahD6CGkz9JBXx2KHbsMifu++Mdh7dyprlxYs5WQO hbTVCfAmRBGzRQC4GpAxyVHpkAupDjs= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=KuK435nG; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf24.hostedemail.com: domain of olsajiri@gmail.com designates 209.85.218.43 as permitted sender) smtp.mailfrom=olsajiri@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1721996794; h=from:from:sender: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:dkim-signature; bh=ZCrMnr3m2dJfLfYaOkFL0+o4FnC8Eb7sKPzJDJllzk8=; b=c5mP+L9RU9d6Hm2AiX1suUg2nD5LNRyuTRv3m18qJKm+l9OZddsQXd89Ne10Tbi0kv7z4u iEkJKM28wysY8oV3U1fRtmA1IxL4hFPFPG6L41Q9b6rFIdikQycHygXtYOQosKvoyhvMoR up+S3f7hUF0SgZunWKgFr016zz+xExM= Received: by mail-ej1-f43.google.com with SMTP id a640c23a62f3a-a7a9a7af0d0so205613366b.3 for ; Fri, 26 Jul 2024 05:27:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1721996829; x=1722601629; darn=kvack.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from:from:to :cc:subject:date:message-id:reply-to; bh=ZCrMnr3m2dJfLfYaOkFL0+o4FnC8Eb7sKPzJDJllzk8=; b=KuK435nGrva2W6TUaG+du08UhkOH1h3b8LZaNJTYC8vjR0z7BWf1tkSYmKMit1w/iP h+rT8Y7Jd6uouRdmgmaqNZQ7DA7AFJ0PvfVHn856BU4QmRVZLnLmKlV/E4INhVbIm8sJ Y3Ip7UInhD+mkc8+bvC2sXQcl+eAISpozDhNnzu3lvEQc2PkKc66+IM4yj8z/mLTvjVU qlolOJBGaR8w+q3SZATPyzvWFbIy1e88heWh8JP6qZN19cAfUXfmStQnqVo5k3uEN+P/ KBOo+16A9ZL+PYOUgYq23w/bi9ZwUTgVC4GslLhwLOx3sasCgSbKMYdt5MFfcENxZTjQ daVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1721996829; x=1722601629; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:date:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ZCrMnr3m2dJfLfYaOkFL0+o4FnC8Eb7sKPzJDJllzk8=; b=EIlwGV3Hs4xixbgqYYv+vahpZQgxq0pvH2xdR0D7dZTA1Nm303/U99CePEVx9FC2Z6 cRnHVds2Rj+h11VgTFDWmgDFBVhSnQ4ozRi4QjnsTovoizXVj5MPUMAsgQ0547SVeQHx 6tAtjSVmpmIDTk2QU/1x5cPek/nVCJtjhbejbJGQ/Z1SThZtT+Ad0vd+DARqCBCGkRST QLog0YtfZ5Y8JK1To/lVjmfESSu2dOHS3JnLvc4+5skC0kaIxvQiuAHgp4L55UpzAJ1P +j/MruyhTz+adVDk0yRpzyp7+gGOZPJMR1cFmgsr8U1XX1Hao8fyRNZevYZGTQSkzq/d l0ng== X-Forwarded-Encrypted: i=1; AJvYcCVzJ1+19OsK6SlnAdn0QDyPY+BGX/GQIm/lKZNLCEmjoLh8awGIVKT9zxokg8uL/79bf79Mj3ma16uz6H40KZcewg0= X-Gm-Message-State: AOJu0YzC3ZwPoGnCvmPswpMrYJUSpebkQTr3GmwGZpFsYrivdMvSQbVa AUANP6XkQV5YUSWvMSfTt2Np3djwhqb464nbRxz5jOYFTorSQGAU X-Google-Smtp-Source: AGHT+IGazZ59kYJhYy4mSMc2usBi0QO3Zjos/v5bRFYjwZc/g8KUTaV9+eTukLHftbKfzGl+5vikhg== X-Received: by 2002:a17:907:98b:b0:a77:cbe5:413f with SMTP id a640c23a62f3a-a7acb3d6a15mr350472166b.4.1721996829213; Fri, 26 Jul 2024 05:27:09 -0700 (PDT) Received: from krava (2001-1ae9-1c2-4c00-726e-c10f-8833-ff22.ip6.tmcz.cz. [2001:1ae9:1c2:4c00:726e:c10f:8833:ff22]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a7acac63795sm172206166b.95.2024.07.26.05.27.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jul 2024 05:27:08 -0700 (PDT) From: Jiri Olsa X-Google-Original-From: Jiri Olsa Date: Fri, 26 Jul 2024 14:27:06 +0200 To: Andrii Nakryiko Cc: Jiri Olsa , Andrii Nakryiko , bpf@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, adobriyan@gmail.com, shakeel.butt@linux.dev, hannes@cmpxchg.org, ak@linux.intel.com, osandov@osandov.com, song@kernel.org Subject: Re: [PATCH v2 bpf-next 10/10] selftests/bpf: add build ID tests Message-ID: References: <20240724225210.545423-1-andrii@kernel.org> <20240724225210.545423-11-andrii@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Rspamd-Queue-Id: 2438F18000F X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: o19hq84gdro6bkgzpksdj49o53znetgq X-HE-Tag: 1721996830-978297 X-HE-Meta: U2FsdGVkX18XsTgoJUdadBvt+HvIxueLqMdQjcV1HGpXyr+9IXXHl49ybOqFNItzYghjtgcKkZV9oylUPcxe8fdaWigXVFcRyiaOYKDLlu6OBDN/Terngz/5E6YhqGtvss+ZVDDFEaoHxMTzrEU9YRkQ4wR/QLR8Na8ElMfGxVAeqDyVDXjJEZsiS5U7+9agZphpBQf3BpKNzKx5g8PEOiCCcAe3YakMvDK9+s9UbkBI+Iwe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JyVz2VhjVMEayEUsp2EwDwmQMe1wqoK14Csv41oE279JnCQ/EujZJjO4SOBs1YmTijAZF2TADIjeNKi/f0n1mR5nVfcUNezw8W3uK3Ane8G4v554t7bCJmZIwzlgZmx5gQz34qCDgR7rZw6g1m+KWhb6qS7eJkL0fGEK1ko6JJeeu4nSEnqkR5XOxpc9osNIWR8aA/1kjvQp/WhaByUzopMzfSqLrjb0KZolMvGuclwNXpX1jOSBSvdnFA7SpI2E4iC+xjkh4s+Ka8wQCVj4wzAv4VazDopd8JJwNbR/XaCkRX4iXhqhoP5t+hsdPTn9g1kA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Thu, Jul 25, 2024 at 01:03:55PM -0700, Andrii Nakryiko wrote: > On Thu, Jul 25, 2024 at 5:12 AM Jiri Olsa wrote: > > > > On Wed, Jul 24, 2024 at 03:52:10PM -0700, Andrii Nakryiko wrote: > > > Add a new set of tests validating behavior of capturing stack traces > > > with build ID. We extend uprobe_multi target binary with ability to > > > trigger uprobe (so that we can capture stack traces from it), but also > > > we allow to force build ID data to be either resident or non-resident in > > > memory (see also a comment about quirks of MADV_PAGEOUT). > > > > > > That way we can validate that in non-sleepable context we won't get > > > build ID (as expected), but with sleepable uprobes we will get that > > > build ID regardless of it being physically present in memory. > > > > > > Also, we add a small add-on linker script which reorders > > > .note.gnu.build-id section and puts it after (big) .text section, > > > putting build ID data outside of the very first page of ELF file. This > > > will test all the relaxations we did in build ID parsing logic in kernel > > > thanks to freader abstraction. > > > > > > Signed-off-by: Andrii Nakryiko > > > > one of my bpf selftests runs showed: > > > > test_build_id:PASS:parse_build_id 0 nsec > > subtest_nofault:PASS:skel_open 0 nsec > > subtest_nofault:PASS:link 0 nsec > > subtest_nofault:PASS:trigger_uprobe 0 nsec > > subtest_nofault:PASS:res 0 nsec > > subtest_nofault:FAIL:build_id_status unexpected build_id_status: actual 1 != expected 2 > > #42/1 build_id/nofault-paged-out:FAIL > > #42/2 build_id/nofault-paged-in:OK > > #42/3 build_id/sleepable:OK > > #42 build_id:FAIL > > > > I could never reproduce again.. but I wonder the the page could sneak > > in before the bpf program is hit and the buildid will get parsed? > > > > Yes, and I just realized that I forgot to mark this test as serial. If > there is parallel test that also runs uprobe_multi and that causes > build_id page to be paged in into page cache, then this might succeed. > So I need to mark the test itself serial. > > Another issue which I was debugging (and fixed) yesterday was that if > the memory passed for MADV_PAGEOUT is not yet memory mapped into the > current process, then it won't be really removed from the page cache. > I avoid that by first paging it in, and then MADV_PAGEOUT. ok, I triggered that in serial run, so I probably hit this one jirka > > > > or maybe likely madvise might just ignore that: > > > > MADV_PAGEOUT (since Linux 5.4) > > Reclaim a given range of pages. This is done to free up memory occupied by these pages. If a page is anonymous, it will be swapped out. If > > a page is file-backed and dirty, it will be written back to the backing storage. The advice might be ignored for some pages in the range > > when it is not applicable. > > > > jirka > > > > > > > --- > > > tools/testing/selftests/bpf/Makefile | 5 +- > > > .../selftests/bpf/prog_tests/build_id.c | 118 ++++++++++++++++++ > > > .../selftests/bpf/progs/test_build_id.c | 31 +++++ > > > tools/testing/selftests/bpf/uprobe_multi.c | 41 ++++++ > > > tools/testing/selftests/bpf/uprobe_multi.ld | 11 ++ > > > 5 files changed, 204 insertions(+), 2 deletions(-) > > > create mode 100644 tools/testing/selftests/bpf/prog_tests/build_id.c > > > create mode 100644 tools/testing/selftests/bpf/progs/test_build_id.c > > > create mode 100644 tools/testing/selftests/bpf/uprobe_multi.ld > > > > > [...]