From patchwork Fri Apr 12 21:15:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 13628347 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9634C14F13E; Fri, 12 Apr 2024 21:16:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712956589; cv=none; b=Z6UcmzRZudGTYD2toLsSZgizlOGTDiA6wckXogAY3TEdf844GPQeKePyxPsfBiYxGfZLPO00+AKPPxcFHJGER57gl3UAAcVj0HCZItRa5mrr+nxeKXfFXE2PFkrcia9Ztecew+J86bH9DNwu0J89I1hULA0gYoMOioZ41wkCp0g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712956589; c=relaxed/simple; bh=QPCVECCkNP/mRX6k0IN6gRC2BYWoQ9twP/v6i1a73s8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AS2MXw+U6hW90wFsxF6pTtWbnh96m7DmWfiVemk+f/AzvmevrIx72nyGMEHHG6YYarXA2HuDd/H1SxBBILt2IlTOChCmdqjAfqeLv6QZFjc+CTQymZP965+cbQZ/aLZjp9NHraooDzjs6PH5CtqW3IGpExOSwGQgIHV8c6FRI7Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Q2Livt2O; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="Q2Livt2O" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09475C113CD; Fri, 12 Apr 2024 21:16:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712956589; bh=QPCVECCkNP/mRX6k0IN6gRC2BYWoQ9twP/v6i1a73s8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q2Livt2OZIU3OAZ8UWJ+fU50KVvij17zdoAIvsYk/jMwUUGqXpiH6kDtI3y8EDM6w dsWLss425CiBDNYuCNTVwrDKXgA5QWvKo1q+ui1tEWh3qat8VecTfyLiHZSdZ98XZs JYSioGYjKcFsZwNsoFekBIyKjzO+D2BKos46mZWnIV3jPaL5Mb7TzQ3b9gP3h3W8hm EHyozg4b2w1QLtAZI5v17zvSaOrHhCWHUO0JKo+EMsHuMviBR9iy0H7XH/22oWkXTs BXneN/0xTvZdub7pUYhvk1LwhEXKfgiIoKpVKeF++YMCZyrltC0FRwLa9aTbemNIo4 5N7mQtSg7ELHA== From: Arnaldo Carvalho de Melo To: dwarves@vger.kernel.org Cc: Jiri Olsa , Clark Williams , Kate Carcia , bpf@vger.kernel.org, Arnaldo Carvalho de Melo , Alan Maguire , Kui-Feng Lee , =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Subject: [PATCH 07/12] core: Add unlocked cus__add() variant Date: Fri, 12 Apr 2024 18:15:59 -0300 Message-ID: <20240412211604.789632-8-acme@kernel.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240412211604.789632-1-acme@kernel.org> References: <20240412211604.789632-1-acme@kernel.org> Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Arnaldo Carvalho de Melo As we'll use with the cus lock already held when getting the next CU from vmlinux to keep the order in the original DWARF file. Cc: Alan Maguire Cc: Kui-Feng Lee Cc: Thomas Weißschuh Signed-off-by: Arnaldo Carvalho de Melo --- dwarves.c | 9 ++++++--- dwarves.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/dwarves.c b/dwarves.c index 3b4be595aa59a856..654a8085e9252a21 100644 --- a/dwarves.c +++ b/dwarves.c @@ -479,13 +479,16 @@ uint32_t cus__nr_entries(const struct cus *cus) return cus->nr_entries; } -void cus__add(struct cus *cus, struct cu *cu) +void __cus__add(struct cus *cus, struct cu *cu) { - cus__lock(cus); - cus->nr_entries++; list_add_tail(&cu->node, &cus->cus); +} +void cus__add(struct cus *cus, struct cu *cu) +{ + cus__lock(cus); + __cus__add(cus, cu); cus__unlock(cus); cu__find_class_holes(cu); diff --git a/dwarves.h b/dwarves.h index 4dfaa01a00f782d9..42b00bc1341e66cb 100644 --- a/dwarves.h +++ b/dwarves.h @@ -171,6 +171,7 @@ int cus__fprintf_load_files_err(struct cus *cus, const char *tool, int cus__load_dir(struct cus *cus, struct conf_load *conf, const char *dirname, const char *filename_mask, const int recursive); +void __cus__add(struct cus *cus, struct cu *cu); void cus__add(struct cus *cus, struct cu *cu); void cus__print_error_msg(const char *progname, const struct cus *cus, const char *filename, const int err);