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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1D6FAC433F5 for ; Fri, 10 Dec 2021 19:25:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=wN3mjLRzZH7u8hPHwjSP8nAVIKQXm420E/MnJtbPcLM=; b=dcfMRKa13GoSYS rDdN/zijbL/iPJqisryoz/extMt0uSj84IYw7u+HV+XwzpLx81Uz3WMq6CoJ7zGFjn9C+frWruvMR 3MW0QnrYMKNsFSQGJd/yWAQdKGeLqrSPG8XukSfJYIk3bd9mxyWHyX+hUCpeO+APdRtFQgfFFu3do E2Y+dd9gpZ89qxM17CkJuDl2ce1+u5NjeHZr49d3GWsxPHcITEFuEDNmXspyZR+CC60naaJfi0c53 9jeCqrMsbA7nfMU5z0+3xFP98/eh51HWP+ab5iIJTyky7Mjpv0BH4iBVif3SCBM1GKsjyabOSa9Q5 67LUgOwLyrXuTqUi9UCg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mvlUk-003Vj2-AT; Fri, 10 Dec 2021 19:23:51 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mvlB7-003NI7-8K for linux-arm-kernel@bombadil.infradead.org; Fri, 10 Dec 2021 19:03:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=oZpRxQ/0rfNB4NbMfItJmQKozKqQIo+jpGOvu75zEGY=; b=CoW6SjPkN5nhMJyYQ3U5csngdM z8FWCPdX0B7xyw9NBzcgZ98giBUE2wcjYnCclptcMzPRyxJrSC/GIqxeNFzOyLPKd4QNVp66ZL/Vr bv2bwj7cYR067TIrexm0AUlfOt0g89XcvXtKKUIMNU9pcFMokuS0evUXuL1wKDZIk4Qp4JjwskTsd /P6bJ4/jJVT+YKJNAVmAsLzEvFZ4NT7hWuETtt4GqL+CcqSA0g1izs7krDk+WOJm/Tjr8Q55tCxtz eOcehqEz12Z50HmVsCrpbdl/Y7y/qOeM0Gg4/MxPHJd+DlH1sxr5ipbSMupXEIVKpeJ5ec/0jrHi+ LAvaSfWQ==; Received: from [179.97.37.151] (helo=quaco.ghostprotocols.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1mvlB5-000bk4-Dh for linux-arm-kernel@lists.infradead.org; Fri, 10 Dec 2021 19:03:31 +0000 Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id 5B6DC405D8; Fri, 10 Dec 2021 16:03:27 -0300 (-03) Date: Fri, 10 Dec 2021 16:03:27 -0300 From: Arnaldo Carvalho de Melo To: James Clark Cc: Leo Yan , mathieu.poirier@linaro.org, coresight@lists.linaro.org, suzuki.poulose@arm.com, Mike Leach , John Garry , Will Deacon , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] perf cs-etm: Remove duplicate and incorrect aux size checks Message-ID: References: <20211208115435.610101-1-james.clark@arm.com> <20211208131753.GC273781@leoy-ThinkPad-X240s> <269d2f14-0594-c73e-97b5-82e72f76e826@arm.com> <20211209134413.GA622826@leoy-ThinkPad-X240s> <6a7fd600-91f3-5feb-d21f-ec7cb704f84c@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <6a7fd600-91f3-5feb-d21f-ec7cb704f84c@arm.com> X-Url: http://acmel.wordpress.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Em Thu, Dec 09, 2021 at 02:16:43PM +0000, James Clark escreveu: > > > On 09/12/2021 13:44, Leo Yan wrote: > > On Wed, Dec 08, 2021 at 02:08:04PM +0000, James Clark wrote: > >> On 08/12/2021 13:17, Leo Yan wrote: > >>> Hi James, > >>> > >>> On Wed, Dec 08, 2021 at 11:54:35AM +0000, James Clark wrote: > >>>> There are two checks, one is for size when running without admin, but > >>>> this one is covered by the driver and reported on in more detail here > >>>> (builtin-record.c): > >>>> > >>>> pr_err("Permission error mapping pages.\n" > >>>> "Consider increasing " > >>>> "/proc/sys/kernel/perf_event_mlock_kb,\n" > >>>> "or try again with a smaller value of -m/--mmap_pages.\n" > >>>> "(current value: %u,%u)\n", > >>> > >>> I looked into the kernel code and found: > >>> > >>> sysctl_perf_event_mlock = 512 + (PAGE_SIZE / 1024); // 512KB + 1 page > >>> > >>> If the system have multiple cores, let's say 8 cores, then kernel even > >>> can relax the limitaion with: > >>> > >>> user_lock_limit *= num_online_cpus(); > >>> > >>> So means the memory lock limitation is: > >>> > >>> (512KB + 1 page) * 8 = 4MB + 8 pages. > >>> > >>> Seems to me, it's much relax than the user space's limitaion 128KB. > >>> And let's imagine for Arm server, the permitted buffer size can be a > >>> huge value (e.g. for a system with 128 cores). > >>> > >>> Could you confirm if this is right? > >> > >> Yes that seems to be the case. And the commit message for that addition > >> states the reasoning: > >> > >> perf_counter: Increase mmap limit > >> > >> In a default 'perf top' run the tool will create a counter for > >> each online CPU. With enough CPUs this will eventually exhaust > >> the default limit. > >> > >> So scale it up with the number of online CPUs. > >> > >> To me that makes sense. Normally the memory installed also scales with the > >> number of cores. > >> > >> Are you saying that we should look into modifying that scaling factor in > >> perf_mmap()? Or that we should still add something to userspace for > >> coresight to limit user supplied buffer sizes? > > > > I don't think we should modify the scaling factor in perf_mmap(), the > > logic is not only used by AUX buffer, it's shared by normal event > > ring buffer. > > > >> I think it makes sense to allow the user to specify any value that will work, > >> it's up to them. > > > > Understand, I verified this patch with below steps: > > > > root@debian:~# echo 0 > /proc/sys/kernel/perf_event_paranoid > > > > leoy@debian:~$ perf record -e cs_etm// -m 4M,8M -o perf_test.data -- sleep 1 > > Permission error mapping pages. > > Consider increasing /proc/sys/kernel/perf_event_mlock_kb, > > or try again with a smaller value of -m/--mmap_pages. > > (current value: 1024,2048) > > > > leoy@debian:~$ perf record -e cs_etm// -m 4M,4M -o perf_test.data -- sleep 1 > > Couldn't synthesize bpf events. > > [ perf record: Woken up 1 times to write data ] > > [ perf record: Captured and wrote 0.607 MB perf_test.data ] > > > > So this patch looks good for me: > > > > Reviewed-by: Leo Yan > > > Thanks Leo! Thanks, applied. - Arnaldo _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel