From nobody Mon Aug 21 13:33:20 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4RTthw4DQxz4qnF7; Mon, 21 Aug 2023 13:33:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4RTthw3gMvz3NyM; Mon, 21 Aug 2023 13:33:20 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692624800; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4t5+YmLRm5RABpZCthbE9Eqy6hy++P/mZQDVudUYQ98=; b=dBxCSoIDPdf8e+jN6JipjDsSONzHUIQByNGziCi5HIKYpIeaUhQHfQGgm0WeuR++W5hca6 M+0DGdNEzqxLMi6cubVNws5iMmt/e4K5Cf+DnWK8q3ceUJNsqNjpPQSQILmeBt1VgSmQhf 0UuunaYjyTSIjMaw6lf+5Ux+1AMa8rWI26uKFarzO0YUtTx9ktGHf2R+OcYaUw5BOXQya6 omEhxVuRm8Hy97GcEXSGqggdALFXXpSMJJLhqL0jLROmivurQzFgmy6FaYqUMQ0Zsp5b0F FH+ted+ig65DI18oxscNM/po14PUsdIEh6fpsgcqy0ZFIzVCsx4kLRBzWIUS6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1692624800; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=4t5+YmLRm5RABpZCthbE9Eqy6hy++P/mZQDVudUYQ98=; b=uubofH6IcnNDohppRVpvXaE6l8s1JZ3IsXFxSCbh8l2Q41yM2ddgqb3Uh92bYN1+pZMLkI WrrcEgy2udBQhyeouGffpE46Q0lRL7Z1gYSrTSA+1iS7+/rfZYP4b+Xkhu+MZZdwSndgoq 36pasz6UDwXjho8EzyxXPMsipialShCmceK1+EEVFNZHPsgyoy3JIXIMpaICnNdFfNxm9e Ukh2QrQb5NCJ2axq1sh0wgG3uZDGL8qLfX0UFEsFrKjGQAhqHslKz5Wv9YtKVr99Bl7gju W1SE1gxNSlHfFnn2PVue1Yk1bHrWuGXXX36QpKPM2MD4tEeiU5NRRFU6PtlKNA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1692624800; a=rsa-sha256; cv=none; b=VQTk1nMQ9VJrC2hIzDdTUIrDsqKwtIzut4VL7MwZKeE719OEbsGHfVntk/cEyVd5hiSB0m kWHfDFN/WR8QtflVxFI1LBo3SOr4GDjd3KfJ9Lnm3EXDeGF08sae13F+AwSvgL3Y9YjICD 6Quryp9E7hos4Y+5foQIgD1WUTfqETxy9qBBiJ+3DsNmsM+k/X2ajSJN/bPI+PPquq/0D0 zgfDRJHW86VdJ2usCJbhC5V1C0pF/SKtqZPg1yuKGGyhGyBBqW36O8+LrYy3Ns3VE7iHmm xFWk6K2KoHc2pHkxnBILUiquBpZuMoouVyc9OWxtTW0PrYar4s9+IGBkgX0+fA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4RTthw2mMrz6yK; Mon, 21 Aug 2023 13:33:20 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 37LDXKor030289; Mon, 21 Aug 2023 13:33:20 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 37LDXKqw030286; Mon, 21 Aug 2023 13:33:20 GMT (envelope-from git) Date: Mon, 21 Aug 2023 13:33:20 GMT Message-Id: <202308211333.37LDXKqw030286@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 3c872a70b883 - main - hwpmc: on process exit, ensure that the owned log is closed List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 3c872a70b883e4e2b38135bd6bd114ac9d2ea579 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3c872a70b883e4e2b38135bd6bd114ac9d2ea579 commit 3c872a70b883e4e2b38135bd6bd114ac9d2ea579 Author: Konstantin Belousov AuthorDate: 2023-08-13 13:42:49 +0000 Commit: Konstantin Belousov CommitDate: 2023-08-21 13:33:13 +0000 hwpmc: on process exit, ensure that the owned log is closed Tested by: pho (previous version) Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D41521 --- sys/dev/hwpmc/hwpmc_mod.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_mod.c b/sys/dev/hwpmc/hwpmc_mod.c index b429f713b09c..de012b74d558 100644 --- a/sys/dev/hwpmc/hwpmc_mod.c +++ b/sys/dev/hwpmc/hwpmc_mod.c @@ -4989,13 +4989,13 @@ pmc_process_exit(void *arg __unused, struct proc *p) } PMC_EPOCH_EXIT(); - if (!is_using_hwpmcs) - return; - PMC_GET_SX_XLOCK(); PMCDBG3(PRC,EXT,1,"process-exit proc=%p (%d, %s)", p, p->p_pid, p->p_comm); + if (!is_using_hwpmcs) + goto out; + /* * Since this code is invoked by the last thread in an exiting process, * we would have context switched IN at some prior point. However, with @@ -5116,6 +5116,8 @@ out: * If the process owned PMCs, free them up and free up memory. */ if ((po = pmc_find_owner_descriptor(p)) != NULL) { + if ((po->po_flags & PMC_PO_OWNS_LOGFILE) != 0) + pmclog_close(po); pmc_remove_owner(po); pmc_destroy_owner_descriptor(po); }