Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp1296314rwe; Thu, 1 Sep 2022 16:17:36 -0700 (PDT) X-Google-Smtp-Source: AA6agR70jHRBMBtv+Ml6y1fqOk+cnwdWSoPd0P+A6+e7HOJiIvxHqmck3FjsgMoymshgVYEjtrBc X-Received: by 2002:a17:906:845c:b0:73d:831e:b73d with SMTP id e28-20020a170906845c00b0073d831eb73dmr24447022ejy.687.1662074255988; Thu, 01 Sep 2022 16:17:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662074255; cv=none; d=google.com; s=arc-20160816; b=Qc9pCS6WsZpEDIJONYcPiJfdjB91cVzpbbcUDKPy39w9twrYbOlNWvGe9Gg180KHnq 4RY95Zy2ksw65lqNm+J5vqO5s/Jp+5rnTQN1fVCruFLLfRDj4DBADB0cRlDrvztHZfRO Vn/dDV5wzd2tNttpB41OTQz1Bxr7pueI7RL985BqNAhkkWrNQ1xyeqJx0LnmbGehh9S+ 05Ep+KSEU2aoGXQwFaXKLQ2u05RRMQXod+q+14fpDPFpuHQtsZFN1pkdtcR10g6K63/j udjM7+ehlIJ2jPAMn8F6PseAtp7D61P5dYY/wzY2ehyImYiHMKVqUiRGEgJmSBRGqYLe +0dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=3wvF0FcYZr+2JRWM3a20xVLyLhpW8cCnaqDIIFrLWJQ=; b=lG55JEov2tbem8IrqPZ5v/475jhq6ZVqhPNwn9USN6QtAHsFnf6W7e039MVzQw77dE EiKgF3q+bMgQgdr/QBdcLDsH60TtwrAujKFqykovcQ9COQtAUDWz53Q9mzRpIQbjApj2 RXizz6PkD7dqlrSMTljTJ4CKbcs8YqwT7H3/rNAFmhFXKWYwN+q0bT4SIEOVinWoVSBx nJmaszlscRiiF2KMjxvAS+pNHUhLAzgd/9Gz3EZf+YGaPceZvamTRVJwvZDqStPaTeWo rAj4YFIGTGY9QL4TdEh/N81zV6dNg5BXz67FDb6lwqt937Jwr6z/PkTmixZOavBElanP Fc7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Hl0CIhIp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ht15-20020a170907608f00b0072fa2e74874si410516ejc.412.2022.09.01.16.17.10; Thu, 01 Sep 2022 16:17:35 -0700 (PDT) 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; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Hl0CIhIp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234824AbiIAW3L (ORCPT + 99 others); Thu, 1 Sep 2022 18:29:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235240AbiIAW2V (ORCPT ); Thu, 1 Sep 2022 18:28:21 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F20F9AA353; Thu, 1 Sep 2022 15:26:12 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A4F7FB8293B; Thu, 1 Sep 2022 22:20:15 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CCEA0C433C1; Thu, 1 Sep 2022 22:20:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1662070814; bh=mbIy7pC35PrOJa2CP0A6d4IoNVjQHLiiPSWGzJbKUYc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Hl0CIhIp4usg8pqBMh8S2ZUpSRS3y4VBReRIf2IlwmJwXyw+4ucaKSiGccSheTR1C nsmhZUJBJxNS/U0jEN8Bj8kQXmCnvUVaf0Ss6AE6n1wWh1PMlFWI22i/oddI/SQszd OSIrF9Rs2+LUHc4P9QwnJcHy5vZvbzskmHznWleANbB5MDCHXMxHmJ4We0RcG7zswL qt3FZkvj+JCtcYsZcS/9YxrXfOzK14tF9UeBK8U2ogHibHnF8Md3fsARcVn2YCFLt4 sBvO7zfNcP4d21Ayt0HaONSb6sMc6t9E+SIxMK4jTDUdLVwYkDNkJksyAUsNYhljf/ SrE5zGMClGY8g== Date: Fri, 2 Sep 2022 01:20:09 +0300 From: Jarkko Sakkinen To: Dave Hansen Cc: linux-sgx@vger.kernel.org, Haitao Huang , Vijay Dhanraj , Reinette Chatre , Dave Hansen , Shuah Khan , open list , "open list:KERNEL SELFTEST FRAMEWORK" Subject: Re: [PATCH 6/6] selftests/sgx: Add a bpftrace script for tracking allocation errors Message-ID: References: <20220830031206.13449-1-jarkko@kernel.org> <20220830031206.13449-7-jarkko@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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, Aug 31, 2022 at 11:23:55AM -0700, Dave Hansen wrote: > On 8/29/22 20:12, Jarkko Sakkinen wrote: > > diff --git a/tools/testing/selftests/sgx/alloc-error.bt b/tools/testing/selftests/sgx/alloc-error.bt > > new file mode 100644 > > index 000000000000..9268d50dea29 > > --- /dev/null > > +++ b/tools/testing/selftests/sgx/alloc-error.bt > > @@ -0,0 +1,7 @@ > > +kr:sgx_alloc_epc_page /(uint64)retval >= (uint64)(-4095)/ { > > + printf("sgx_alloc_epc_page: retval=%d\n", (int64)retval); > > +} > > + > > +kr:sgx_encl_page_alloc /(uint64)retval >= (uint64)(-4095)/ { > > + printf("sgx_encl_page_alloc: retval=%d\n", (int64)retval); > > +} > > I guess this doesn't _hurt_, but it's also not exactly the easiest way > to get this done. You need a whole bpf toolchain. You could also just do: > > perf probe 'sgx_encl_page_alloc%return $retval' > > Even *that* can be replicated in a few scant lines of shell code echoing > into /sys/kernel/debug/tracing. Thanks, I have not used perf that much. What if I replace this with a shell script using perf? How do you use that for two kretprobes? BR, Jarkko