Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2290702pxb; Wed, 9 Feb 2022 15:18:38 -0800 (PST) X-Google-Smtp-Source: ABdhPJx0XfOh5dfgf8dUAzNM7WtaeNpd8Ye4eAjDgDW0/+X7G32Thf9lIPSSaCm7jTbWnOEm2A7c X-Received: by 2002:a63:35c2:: with SMTP id c185mr3801665pga.195.1644448718030; Wed, 09 Feb 2022 15:18:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644448718; cv=none; d=google.com; s=arc-20160816; b=d8vACRVnGAvmfOqpzOiFDS45x0whCUDlkXjLZ+cKUt/on545sD2lYdIBBnsN6lYLWi uszT+qV3Sm3Vey0kp2VdgkVwBKXtWmJhjNei2yE/NOZI2NSFxrCNf2uMEwUs+YLMYZ03 2e111xbL27CY5mVFdDxLpTOZScJR+lnF7l8Qkj65k59SS0gmOMW1n6ie6ItsuweCddVN C90sWbPOS1FTEt7UWY5W8L2f8J6tvJNOlSYhbe2A0JL4PQGYBD+EdqIXSCWiitAupO5E ZbnGCtwj0IzWqiMSk7XNQY/QJHwa/2Gh9tKeArmmMBy5XCAczNKQ5RtlilMs40BDPLtW GZNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=UuA86Nyzl5Eui91dzFfwf9ECfs1Xn0BsmmUF+q9vMTM=; b=NLJY+gZ8xpiM/Rhd+NjVquw2nPhxeVOfeVPFBc9fbjnkf6n7UzpalGdXiWRtuzxY1B pOKmDRHw7rVpwv5PRxzKnTDpkYb2KysEpEfcRb+ttIYRTwX0WJL8lTaHs7dHZSRU3Qx8 gknMFFLmiy6Qx2oQybtf4I0DKrtF8ujdm2L0yTSilMYZe1ZWIGgTJ+8uVn7qahfIFps7 YVLBU9ukrl5v5gKRtXCYkUbTrpk1UIUJsauu6WIZUCVlnju618jbo/ncEdmFL87ryMxr kSyJzwq/B7433wKmutkBhyFhfjQBrQJBDXWAxrrp96Anrhb3nTnxBFmz5IfFhSpiMvmK uRQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KP4fkOI7; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id pf5si2687630pjb.125.2022.02.09.15.18.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 15:18:38 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=KP4fkOI7; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A3ABDE05658A; Wed, 9 Feb 2022 15:16:04 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231808AbiBITNk (ORCPT + 99 others); Wed, 9 Feb 2022 14:13:40 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:34920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230198AbiBITNh (ORCPT ); Wed, 9 Feb 2022 14:13:37 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 423ECC014F39 for ; Wed, 9 Feb 2022 11:13:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1644433740; h=from:from: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; bh=UuA86Nyzl5Eui91dzFfwf9ECfs1Xn0BsmmUF+q9vMTM=; b=KP4fkOI7PVi4YV3550bIV7XiEIcQeiKoxrODZiulXNKnnczkzEL1fkZqG98Bepv7KFwPQ0 8Bry1r9jFyLUVgEeH+7Pa3J70dQKnYtUetiylO8kdsKq4J74oOtjRmA1v+Gzd4p8EU3tmm fXtWIkPEMK8VR+PVP6uJmYKysBmghCM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-258-3vO76ThsNKa4dxfImmOr4g-1; Wed, 09 Feb 2022 14:02:40 -0500 X-MC-Unique: 3vO76ThsNKa4dxfImmOr4g-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B83311966323; Wed, 9 Feb 2022 19:02:37 +0000 (UTC) Received: from [10.22.9.207] (unknown [10.22.9.207]) by smtp.corp.redhat.com (Postfix) with ESMTP id 69C2410013C1; Wed, 9 Feb 2022 19:02:35 +0000 (UTC) Message-ID: <69e5f778-8715-4acf-c027-58b6ec4a9e77@redhat.com> Date: Wed, 9 Feb 2022 14:02:34 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [RFC 00/12] locking: Separate lock tracepoints from lockdep/lock_stat (v1) Content-Language: en-US To: Mathieu Desnoyers Cc: Peter Zijlstra , Namhyung Kim , Ingo Molnar , Will Deacon , Boqun Feng , linux-kernel , Thomas Gleixner , rostedt , Byungchul Park , "Paul E. McKenney" , Radoslaw Burny , Tejun Heo , rcu , cgroups , linux-btrfs , intel-gfx@lists.freedesktop.org References: <20220208184208.79303-1-namhyung@kernel.org> <20220209090908.GK23216@worktop.programming.kicks-ass.net> <24fe6a08-5931-8e8d-8d77-459388c4654e@redhat.com> <919214156.50301.1644431371345.JavaMail.zimbra@efficios.com> From: Waiman Long In-Reply-To: <919214156.50301.1644431371345.JavaMail.zimbra@efficios.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no 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 2/9/22 13:29, Mathieu Desnoyers wrote: > ----- On Feb 9, 2022, at 1:19 PM, Waiman Long longman@redhat.com wrote: > >> On 2/9/22 04:09, Peter Zijlstra wrote: >>> On Tue, Feb 08, 2022 at 10:41:56AM -0800, Namhyung Kim wrote: >>> >>>> Eventually I'm mostly interested in the contended locks only and I >>>> want to reduce the overhead in the fast path. By moving that, it'd be >>>> easy to track contended locks with timing by using two tracepoints. >>> So why not put in two new tracepoints and call it a day? >>> >>> Why muck about with all that lockdep stuff just to preserve the name >>> (and in the process continue to blow up data structures etc..). This >>> leaves distros in a bind, will they enable this config and provide >>> tracepoints while bloating the data structures and destroying things >>> like lockref (which relies on sizeof(spinlock_t)), or not provide this >>> at all. >>> >>> Yes, the name is convenient, but it's just not worth it IMO. It makes >>> the whole proposition too much of a trade-off. >>> >>> Would it not be possible to reconstruct enough useful information from >>> the lock callsite? >>> >> I second that as I don't want to see the size of a spinlock exceeds 4 >> bytes in a production system. >> >> Instead of storing additional information (e.g. lock name) directly into >> the lock itself. Maybe we can store it elsewhere and use the lock >> address as the key to locate it in a hash table. We can certainly extend >> the various lock init functions to do that. It will be trickier for >> statically initialized locks, but we can probably find a way to do that too. > If we go down that route, it would be nice if we can support a few different > use-cases for various tracers out there. > > One use-case (a) requires the ability to query the lock name based on its address as key. > For this a hash table is a good fit. This would allow tracers like ftrace to > output lock names in its human-readable output which is formatted within the kernel. > > Another use-case (b) is to be able to "dump" the lock { name, address } tuples > into the trace stream (we call this statedump events in lttng), and do the > translation from address to name at post-processing. This simply requires > that this information is available for iteration for both the core kernel > and module locks, so the tracer can dump this information on trace start > and module load. > > Use-case (b) is very similar to what is done for the kernel tracepoints. Based > on this, implementing the init code that iterates on those sections and populates > a hash table for use-case (a) should be easy enough. Yes, that are good use cases for this type of functionality. I do need to think about how to do it for statically initialized lock first. Thanks, Longman