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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76DEDC65C0D for ; Wed, 31 Aug 2022 18:28:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231845AbiHaS2y (ORCPT ); Wed, 31 Aug 2022 14:28:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232473AbiHaS2Q (ORCPT ); Wed, 31 Aug 2022 14:28:16 -0400 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45A9FBCCC6; Wed, 31 Aug 2022 11:24:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661970242; x=1693506242; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=wXM2hIDhlZVfZnXfi1q7P4cdxCTlqnnAsMQBb9mpon4=; b=Zh5QJFrbuzP0UEXKMISBw2lcXRy3b6nm+/VSRmVSw7PN2AZ1HNbs6ISW NwzyLK44Gv8hFf5Z2R8VGqHC9kwVQaH7Xmak65Wt+a70oPyNMeIJ5Tq+u O3BGmbOGno6N5s3PFEGuGFyWNsC0v+bMjHfqUk2+Pdj/IkNp7mgkO5FGO QtIbXH2jx9S91M5kN6ysZfCWbmaBkU8ZltBvJEKCrX1yK1zNpX0cgEDkG c/B8FG3sPt9NoQ43ag1EcRXVzySl/bj9blIkXHqD8Z1ixpKDKX0onczdL ZwS56YYsZI0JFQ8ErbOuPkhTfhNDv21elm1kXhwXMshMpuv5EKt/lDAwc g==; X-IronPort-AV: E=McAfee;i="6500,9779,10456"; a="357232666" X-IronPort-AV: E=Sophos;i="5.93,278,1654585200"; d="scan'208";a="357232666" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2022 11:23:56 -0700 X-IronPort-AV: E=Sophos;i="5.93,278,1654585200"; d="scan'208";a="612187466" Received: from nkrobins-mobl2.amr.corp.intel.com (HELO [10.212.220.19]) ([10.212.220.19]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 31 Aug 2022 11:23:56 -0700 Message-ID: Date: Wed, 31 Aug 2022 11:23:55 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Subject: Re: [PATCH 6/6] selftests/sgx: Add a bpftrace script for tracking allocation errors Content-Language: en-US To: Jarkko Sakkinen , linux-sgx@vger.kernel.org Cc: Haitao Huang , Vijay Dhanraj , Reinette Chatre , Dave Hansen , Shuah Khan , open list , "open list:KERNEL SELFTEST FRAMEWORK" References: <20220830031206.13449-1-jarkko@kernel.org> <20220830031206.13449-7-jarkko@kernel.org> From: Dave Hansen In-Reply-To: <20220830031206.13449-7-jarkko@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org 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.