Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp2189004pxb; Wed, 9 Feb 2022 12:48:06 -0800 (PST) X-Google-Smtp-Source: ABdhPJwT4vhJyNXOMBQ7h8ndQwCEWNR7Dd/hr2E6eg24i1J44Xwor+lHVyUMOvESM/IT1eXscgia X-Received: by 2002:a17:90a:13c5:: with SMTP id s5mr4620208pjf.181.1644439686115; Wed, 09 Feb 2022 12:48:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644439686; cv=none; d=google.com; s=arc-20160816; b=0c/8/Fnpele4bLgyNjdokiAEhb88uIOpPMw3w8ocSvF5h4lyStMplXr12/BtOr2IqJ g3Co80tfaQ/y30hQXSX3xU2TxUsrKnNKWnbW+NnmXrakgeyR2dGGgWu/x/NvvMmRTmXb aLVm8J/hDrs5HH6dosK/el73jlc/VmdK+iHF0M5MUB20nhBxutXJvmw+MYzYg7MW8oqu TMn41QfblfQdJZdTscmPC1JKfL2+UbW3/WTl62VGDYvAXq/72QX+n/Rkg/kGbR5X5TRz ILW5ONmf4RkiP5v83q9jN4JqLELwZ90mjvQL1gHp1vYlzTHg5Ea7fbpRKc1MZ62S2xlL 9USw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date:dkim-signature:dkim-filter; bh=TGXHNcESyLk7e4fzBk383pOUPG79qFlYdVN8p53Ep/Q=; b=E8XeLAbHs1ebn3ZNQx+0hUWTevi3C/JNLkyBDBpCo83NqNfQ9uyNXKpnG7NP5+kxxg JPmaodHVJzxoBYdkaOsFNJ2e5n0JltFfWetcmYL9NmlZCfRoUA/bFKl7Gjpx+CnMbmgC es870qzGQTDqNp/1LGhIx2BuPToB8V12cL40aNeG8xpCyN/cL+1WKYGFAlxFGvqG0ESF 6WoqYOSEW7a7KdwSEcxSapXmdSIV13MSRnUQyQ/K72uhl8pUGQxihmFelzz//4JjSKFT e29dF/XtK13zO6o30mcsiiNcBEjhBT7pp9T3d084g6zGKl//hgbUMvaqSypV7wefHB5E ju9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=o2rMAwb8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d3si16177936pgh.861.2022.02.09.12.48.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 12:48:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=default header.b=o2rMAwb8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9EE45E095C0A; Wed, 9 Feb 2022 12:12:20 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229903AbiBIT4m (ORCPT + 99 others); Wed, 9 Feb 2022 14:56:42 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:39846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229853AbiBIT4Y (ORCPT ); Wed, 9 Feb 2022 14:56:24 -0500 Received: from mail.efficios.com (mail.efficios.com [167.114.26.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E3DEE063140; Wed, 9 Feb 2022 11:56:25 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 9417B3B5086; Wed, 9 Feb 2022 14:56:24 -0500 (EST) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 07TCclwxL99S; Wed, 9 Feb 2022 14:56:24 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id E627B3B4E7F; Wed, 9 Feb 2022 14:56:23 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com E627B3B4E7F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1644436583; bh=TGXHNcESyLk7e4fzBk383pOUPG79qFlYdVN8p53Ep/Q=; h=Date:From:To:Message-ID:MIME-Version; b=o2rMAwb82gk7CvIC1/Lg6Ovt8Ys6ualxXZZEJUIKPgpUsZnCRkpg0CTrB6sSGJHw4 OGw22rdi0SSLref9YrWriHrt4yZXTgoVohqZF5bRFmtFF1xwyls8hv2A+THlk0FHMu tiOkWfGSipmXDJGG0hD9nxGnUNw28RXeYFKHNvJMTJEt19vk9eFeRK3AKqT6Zd+Rfq Eli3lK06XO9htl+iJXGczHmHtM5VJoxV8wYgHNYdOXotrFgrQh2BcLtrwe1a/9VVfJ z4tNmAat+9f3PE1+P2dRQt+/bBMnlw44dJZYqv1P6HvSjjbIakgi7sEATlyFrZynWi WsAcN9S5ot38g== X-Virus-Scanned: amavisd-new at efficios.com Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id nabkake81CbX; Wed, 9 Feb 2022 14:56:23 -0500 (EST) Received: from mail03.efficios.com (mail03.efficios.com [167.114.26.124]) by mail.efficios.com (Postfix) with ESMTP id D177F3B4BD0; Wed, 9 Feb 2022 14:56:23 -0500 (EST) Date: Wed, 9 Feb 2022 14:56:23 -0500 (EST) From: Mathieu Desnoyers To: Namhyung Kim Cc: Waiman Long , Peter Zijlstra , Ingo Molnar , Will Deacon , Boqun Feng , linux-kernel , Thomas Gleixner , rostedt , Byungchul Park , Radoslaw Burny , Tejun Heo , rcu , cgroups , linux-btrfs , intel-gfx , paulmck Message-ID: <575163430.50481.1644436583757.JavaMail.zimbra@efficios.com> In-Reply-To: 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> <69e5f778-8715-4acf-c027-58b6ec4a9e77@redhat.com> <718973621.50447.1644434890744.JavaMail.zimbra@efficios.com> Subject: Re: [RFC 00/12] locking: Separate lock tracepoints from lockdep/lock_stat (v1) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [167.114.26.124] X-Mailer: Zimbra 8.8.15_GA_4203 (ZimbraWebClient - FF96 (Linux)/8.8.15_GA_4203) Thread-Topic: locking: Separate lock tracepoints from lockdep/lock_stat (v1) Thread-Index: 8v1yUUmpj7eA9y5pJI4+3hvYOKV87w== X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 Feb 9, 2022, at 2:45 PM, Namhyung Kim namhyung@kernel.org wrote: > On Wed, Feb 9, 2022 at 11:28 AM Mathieu Desnoyers > wrote: >> >> ----- On Feb 9, 2022, at 2:22 PM, Namhyung Kim namhyung@kernel.org wrote: >> > I'm also concerning dynamic allocated locks in a data structure. >> > If we keep the info in a hash table, we should delete it when the >> > lock is gone. I'm not sure we have a good place to hook it up all. >> >> I was wondering about this use case as well. Can we make it mandatory to >> declare the lock "class" (including the name) statically, even though the >> lock per-se is allocated dynamically ? Then the initialization of the lock >> embedded within the data structure would simply refer to the lock class >> definition. > > Isn't it still the same if we have static lock classes that the entry needs > to be deleted from the hash table when it frees the data structure? > I'm more concerned about free than alloc as there seems to be no > API to track that in a place. If the lock class is defined statically, even for dynamically initialized locks, then its associated object sits either in the core kernel or within a module. So if it's in the core kernel, it could be added to the hash table at kernel init and stay there forever. If it's in a module, it would be added to the hash table on module load and removed on module unload. We would have to be careful about how the ftrace printout to human readable text deals with missing hash table data, because that printout will happen after buffering, so an untimely module unload could make this address to string mapping unavailable for a few events. If we care about getting this corner case right there are a few things we could do as well. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. http://www.efficios.com