Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1792295rwb; Mon, 7 Nov 2022 05:59:40 -0800 (PST) X-Google-Smtp-Source: AA0mqf5tw54DkfEoMwrYWUZwizDL66G4MfwrhbJDyddev367T41V5MKXjy64LD6Xsxf7ZAlyCsiy X-Received: by 2002:a63:798b:0:b0:470:5b0d:b6a6 with SMTP id u133-20020a63798b000000b004705b0db6a6mr9449258pgc.275.1667829580214; Mon, 07 Nov 2022 05:59:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1667829580; cv=none; d=google.com; s=arc-20160816; b=ebMCyG/ybu1yeUA7SjrflWfJG2EKrtKpcqvYWpreqy5G80DJ4xgVHKTk4V4YwyYD5a YsjYwGU09JhVHrKVlTiZkXkbOolBwazXDZs4G2pNCQuRYM398dA/K9oQrgc4CI9f8mK9 kgGMFkApfehBDiNIpXML9y4r8trLhANEtuC0EF4MZ6QIbim8a/CpQboLBiwHcFk1d7Ox rkAzvLYwX9+OnPjmkgtSLU+d4rudDeR4q7q3cn+uJivnu6DrRI4Oa8oA8J5LuZ8Fsq9T TWkb8PZCEIrjb7/+wAYVc8USfDRcqTRnS/a/EbRL6yJMAbXyvXOI+uHH0ebl619yFEWK UCJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=Shz+A9X5HFzHImmvrmpjAHGYVi0tNQ22oJPnuzaBWgw=; b=L+sgG8FWqcS2RfbLX9yjU51/5BtAj+6APoEpD81uAA9Vl++r2fXN7r8PuY5rqWg2tE +cMIw27dlz/56rYlrsVKtIycWhOBD1YUZ5++UAo5jyQhSLO1iJXtw2teCTQOfJVm3M8/ /WiYqiCXM6j9ouaxAdtJv2ZpzYKFCaISevb/rXa3AetGWcd/cRypmHajbccBGc/4SWU/ YvgwhAjpg3eUHDecrr1ZT3bBY5kw6mVAqKB9JZMd5W5vLExzijy9TG4Q4gg9562coE/K geSZwQ8h9ybgsD1R7mmMNoWayApYLH53GGvE5175Mgq5TL4jfAdWzChlGnG6nsD9o4qI wfLw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w18-20020a170902e89200b00186a185131asi13159091plg.0.2022.11.07.05.59.27; Mon, 07 Nov 2022 05:59:40 -0800 (PST) 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 S231899AbiKGNng (ORCPT + 93 others); Mon, 7 Nov 2022 08:43:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231795AbiKGNnd (ORCPT ); Mon, 7 Nov 2022 08:43:33 -0500 X-Greylist: delayed 401 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 07 Nov 2022 05:43:31 PST Received: from second.openwall.net (second.openwall.net [193.110.157.125]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 14EBEC0F for ; Mon, 7 Nov 2022 05:43:30 -0800 (PST) Received: (qmail 22500 invoked from network); 7 Nov 2022 13:36:47 -0000 Received: from localhost (HELO pvt.openwall.com) (127.0.0.1) by localhost with SMTP; 7 Nov 2022 13:36:47 -0000 Received: by pvt.openwall.com (Postfix, from userid 503) id 7B532AB3A4; Mon, 7 Nov 2022 14:36:28 +0100 (CET) Date: Mon, 7 Nov 2022 14:36:28 +0100 From: Solar Designer To: Masami Hiramatsu Cc: wuqiang , davem@davemloft.net, anil.s.keshavamurthy@intel.com, naveen.n.rao@linux.ibm.com, linux-kernel@vger.kernel.org, mattwu@163.com, Adam Zabrocki Subject: Re: [PATCH] kretprobe events missing on 2-core KVM guest Message-ID: <20221107133628.GA31649@openwall.com> References: <20221025100117.18667-1-wuqiang.matt@bytedance.com> <20221026003315.266d59d5c0780c2817be3a0d@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221026003315.266d59d5c0780c2817be3a0d@kernel.org> User-Agent: Mutt/1.4.2.3i X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS 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: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 26, 2022 at 12:33:15AM +0900, Masami Hiramatsu wrote: > On Tue, 25 Oct 2022 18:01:17 +0800 > wuqiang wrote: > > > Default value of maxactive is set as num_possible_cpus() for nonpreemptable > > systems. For a 2-core system, only 2 kretprobe instances would be allocated > > in default, then these 2 instances for execve kretprobe are very likely to > > be used up with a pipelined command. > > > > This patch increases the minimum of maxactive to 10. > > This looks reasonable to me. > > Acked-by: Masami Hiramatsu (Google) Reasonable yes, but: Is 10 enough? How exactly do those instances get used up without preemption? Perhaps because execve can sleep? If so, perhaps we should use the same logic without preemption that we do with preemption? So maybe just make this line unconditional? - rp->maxactive = max_t(unsigned int, 10, 2*num_possible_cpus()); Also, the behavior was documented in Documentation/trace/kprobes.rst, so perhaps that file should be updated at the same time with the code. > > Signed-off-by: wuqiang > > --- > > kernel/kprobes.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/kernel/kprobes.c b/kernel/kprobes.c > > index 3220b0a2fb4a..b781dee3f552 100644 > > --- a/kernel/kprobes.c > > +++ b/kernel/kprobes.c > > @@ -2211,7 +2211,7 @@ int register_kretprobe(struct kretprobe *rp) > > #ifdef CONFIG_PREEMPTION > > rp->maxactive = max_t(unsigned int, 10, 2*num_possible_cpus()); > > #else > > - rp->maxactive = num_possible_cpus(); > > + rp->maxactive = max_t(unsigned int, 10, num_possible_cpus()); > > #endif > > } > > #ifdef CONFIG_KRETPROBE_ON_RETHOOK > > -- > > 2.34.1 > > > > > -- > Masami Hiramatsu (Google) Thanks, Alexander