Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp824526rwe; Thu, 25 Aug 2022 09:43:00 -0700 (PDT) X-Google-Smtp-Source: AA6agR4ThnZj57vvqbqrJzy+mfnh5dRgi1kmuVuTmbPpgE2BwQ6sZcmutXo+M7w8ri4zHSn9E+22 X-Received: by 2002:a05:6402:369a:b0:43d:75c5:f16c with SMTP id ej26-20020a056402369a00b0043d75c5f16cmr3773860edb.57.1661445780691; Thu, 25 Aug 2022 09:43:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661445780; cv=none; d=google.com; s=arc-20160816; b=JKclzknBwnhJyUavpbdF35MIbBtRKkK74r4hZB4lrR63ps+kxMzk3273r9mCO0U1le 20MxRM7t0BOW3aefOTguduXlAhtnwW58xreMBjYZpiXWa3nP868OJKcbt3VK2fblKmmh u4k2fZ68Bb3+naLwNlj8hDQPbEoMAYa1ydD4Qlt8yWI61E/oUbcU/GrrDcHJFQ26ZAa6 IJMCngBVHUuMWliRTRLoVVWhwz2/koYi56hS+QHQE9CrG6K4WQBPkkv1dN2nyqeIO9xC aMVEtIclCiCN2cfLaL3yW2y4cJzpeDqZ9NeI9EB46WShyLFOpT6ZIN1huYondr2vMPRk +5tA== 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 :organization:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=fJSRUyN7Hg3MNePHtZYa4/g+YMBmWgcWsFjwD54y+mc=; b=VMut9E8Ijy51GYJfsvPHoFhMAutMcgZ+akoP9Bdv0yVaNsOT0h/jWMvcgI3jHPB7yN PPhppsTacIwdfnB7X7oBugzbD2YzqBXSSinL6TNqFmNPLCAayZdZOq0F2HA3yiUEH6RY d/1H3v1vzVWfimFfryFXmvcOD5XzzTX0EfNqDld3uOp/0UnhkOQ3DjyVJvTAmGhzVjvg wYUn2Cys9dUr/v0beXveEO9D2M9DRWHm4fxisMxuhEbhd07D+6RY2WemqOvGgsnjBRnU bSr7Yw+4VmieGiMc+55qda6UPtvO0gXiZmTODHBONy0c9eHDCmxLrRrgENzJeGZ0RTcu Zkmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=SFJYUskL; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a17090658c600b0073d76d8af85si4470156ejs.231.2022.08.25.09.42.35; Thu, 25 Aug 2022 09:43:00 -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=@intel.com header.s=Intel header.b=SFJYUskL; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242997AbiHYQUk (ORCPT + 99 others); Thu, 25 Aug 2022 12:20:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243044AbiHYQUa (ORCPT ); Thu, 25 Aug 2022 12:20:30 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 44F74A0268; Thu, 25 Aug 2022 09:20:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1661444427; x=1692980427; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=dexjnAFY5uhDar1V0uA27KUIA1B5OYcNy4yxSywmqjs=; b=SFJYUskLRA21SYfnuDUQvU10s/wlLNInvupaDs6v0hSwAnnNz6UDFtAC M9BvN9VmYwkPT7sPvxKElAz093pNxhi9NJjP2JJiO8kg/JTNpJuOeL9TI bNzZCuB21tWOxpjbLP5MmMvq/R4u0Z1Jjqpmy5cnArpWDtIdHd1Aa4KcA PXQBxKrDvkr9MnnECoS867/jbsMRCdzh+8b9MnDyRLt7R7Fs5XKJ96G0w /QmDNzmIGvZOlNbNZUrQmR08apLBMklsb8QdFcemmdnITqAnYCPlrptYO n/yBUoY67pPscNN+6fmuxWGyyMbGevOgGXwCB8SMvj8tswUsT0yJ+4oJe w==; X-IronPort-AV: E=McAfee;i="6500,9779,10450"; a="291862665" X-IronPort-AV: E=Sophos;i="5.93,263,1654585200"; d="scan'208";a="291862665" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2022 09:15:04 -0700 X-IronPort-AV: E=Sophos;i="5.93,263,1654585200"; d="scan'208";a="671059006" Received: from ahunter6-mobl1.ger.corp.intel.com (HELO [10.0.2.15]) ([10.252.52.129]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Aug 2022 09:14:52 -0700 Message-ID: Date: Thu, 25 Aug 2022 19:14:47 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Firefox/91.0 Thunderbird/91.11.0 Subject: Re: [PATCH v3 00/18] Mutex wrapper, locking and memory leak fixes Content-Language: en-US To: Arnaldo Carvalho de Melo , Ian Rogers Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Thomas Gleixner , Darren Hart , Davidlohr Bueso , =?UTF-8?Q?Andr=c3=a9_Almeida?= , Nathan Chancellor , Nick Desaulniers , Tom Rix , Weiguo Li , Athira Rajeev , Thomas Richter , Ravi Bangoria , Dario Petrillo , Hewenliang , yaowenbin , Wenyu Liu , Song Liu , Andrii Nakryiko , Dave Marchevsky , Leo Yan , Kim Phillips , Pavithra Gurushankar , Alexandre Truong , Quentin Monnet , William Cohen , Andres Freund , =?UTF-8?Q?Martin_Li=c5=a1ka?= , Colin Ian King , James Clark , Fangrui Song , Stephane Eranian , Kajol Jain , Alexey Bayduraev , Riccardo Mancini , Andi Kleen , Masami Hiramatsu , Zechuan Chen , Jason Wang , Christophe JAILLET , Remi Bernon , Linux Kernel Mailing List , linux-perf-users , bpf , llvm@lists.linux.dev References: <20220824153901.488576-1-irogers@google.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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 25/08/22 15:30, Arnaldo Carvalho de Melo wrote: > On Wed, Aug 24, 2022, 12:39 PM Ian Rogers > wrote: > > When fixing a locking race and memory leak in: > https://lore.kernel.org/linux-perf-users/20211118193714.2293728-1-irogers@google.com/ > > It was requested that debug mutex code be separated out into its own > files. This was, in part, done by Pavithra Gurushankar in: > https://lore.kernel.org/lkml/20220727111954.105118-1-gpavithrasha@gmail.com/ > > These patches fix issues with the previous patches, add in the > original dso->nsinfo fix and then build on our mutex wrapper with > clang's -Wthread-safety analysis. The analysis found missing unlocks > in builtin-sched.c which are fixed and -Wthread-safety is enabled by > default when building with clang. > > v3. Adds a missing new line to the error messages and removes the >     pshared argument to mutex_init by having two functions, mutex_init >     and mutex_init_pshared. These changes were suggested by Adrian Hunter. > > > Adrian, can I have your Acked-by or, better, Reviewed-by? Sure, just let me have another look. Should get to it tomorrow. > > Thanks,  > > -  Arnaldo  > > v2. Breaks apart changes that s/pthread_mutex/mutex/g and the lock >     annotations as requested by Arnaldo and Namhyung. A boolean is >     added to builtin-sched.c to terminate thread funcs rather than >     leaving them blocked on delted mutexes. > > Ian Rogers (17): >   perf bench: Update use of pthread mutex/cond >   perf tests: Avoid pthread.h inclusion >   perf hist: Update use of pthread mutex >   perf bpf: Remove unused pthread.h include >   perf lock: Remove unused pthread.h include >   perf record: Update use of pthread mutex >   perf sched: Update use of pthread mutex >   perf ui: Update use of pthread mutex >   perf mmap: Remove unnecessary pthread.h include >   perf dso: Update use of pthread mutex >   perf annotate: Update use of pthread mutex >   perf top: Update use of pthread mutex >   perf dso: Hold lock when accessing nsinfo >   perf mutex: Add thread safety annotations >   perf sched: Fixes for thread safety analysis >   perf top: Fixes for thread safety analysis >   perf build: Enable -Wthread-safety with clang > > Pavithra Gurushankar (1): >   perf mutex: Wrapped usage of mutex and cond > >  tools/perf/Makefile.config                 |   5 + >  tools/perf/bench/epoll-ctl.c               |  33 +++--- >  tools/perf/bench/epoll-wait.c              |  33 +++--- >  tools/perf/bench/futex-hash.c              |  33 +++--- >  tools/perf/bench/futex-lock-pi.c           |  33 +++--- >  tools/perf/bench/futex-requeue.c           |  33 +++--- >  tools/perf/bench/futex-wake-parallel.c     |  33 +++--- >  tools/perf/bench/futex-wake.c              |  33 +++--- >  tools/perf/bench/numa.c                    |  93 ++++++---------- >  tools/perf/builtin-inject.c                |   4 + >  tools/perf/builtin-lock.c                  |   1 - >  tools/perf/builtin-record.c                |  13 ++- >  tools/perf/builtin-sched.c                 | 105 +++++++++--------- >  tools/perf/builtin-top.c                   |  45 ++++---- >  tools/perf/tests/mmap-basic.c              |   2 - >  tools/perf/tests/openat-syscall-all-cpus.c |   2 +- >  tools/perf/tests/perf-record.c             |   2 - >  tools/perf/ui/browser.c                    |  20 ++-- >  tools/perf/ui/browsers/annotate.c          |  12 +-- >  tools/perf/ui/setup.c                      |   5 +- >  tools/perf/ui/tui/helpline.c               |   5 +- >  tools/perf/ui/tui/progress.c               |   8 +- >  tools/perf/ui/tui/setup.c                  |   8 +- >  tools/perf/ui/tui/util.c                   |  18 ++-- >  tools/perf/ui/ui.h                         |   4 +- >  tools/perf/util/Build                      |   1 + >  tools/perf/util/annotate.c                 |  15 +-- >  tools/perf/util/annotate.h                 |   4 +- >  tools/perf/util/bpf-event.h                |   1 - >  tools/perf/util/build-id.c                 |  12 ++- >  tools/perf/util/dso.c                      |  19 ++-- >  tools/perf/util/dso.h                      |   4 +- >  tools/perf/util/hist.c                     |   6 +- >  tools/perf/util/hist.h                     |   4 +- >  tools/perf/util/map.c                      |   3 + >  tools/perf/util/mmap.h                     |   1 - >  tools/perf/util/mutex.c                    | 119 +++++++++++++++++++++ >  tools/perf/util/mutex.h                    | 109 +++++++++++++++++++ >  tools/perf/util/probe-event.c              |   3 + >  tools/perf/util/symbol.c                   |   4 +- >  tools/perf/util/top.h                      |   5 +- >  41 files changed, 570 insertions(+), 323 deletions(-) >  create mode 100644 tools/perf/util/mutex.c >  create mode 100644 tools/perf/util/mutex.h > > -- > 2.37.2.609.g9ff673ca1a-goog >