From nobody Wed Jun 01 18:53:14 2022 X-Original-To: dev-commits-src-main@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 BCAF51B6C3B5; Wed, 1 Jun 2022 18:53:14 +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 4LCyvt4tmgz4VMM; Wed, 1 Jun 2022 18:53:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654109594; 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=UGIv9tirMg7DU3JmIfCUzXbE+FWDT7qPIfDdMpdcI58=; b=hLpoD6fkIu5S6kM+i4tUWzc5dLlowaSGb7wBRYXNyYm8x22YUii1irho0cNHaT4jR6nenk D2JyIcx7VLALwjKIm5dZIFlGEvfoOY3cTuqaNK8X4Vdu7igAUg0I3sk/GgyMOBn/G4/MLS BhOlj7RmMEZaiRHERb/Fe4myxSIplh/GJ3ZEsqoyA9vd9etwgHjPLXuG7YWYVDmxfZM2WD gQpyfOLSZch0Oa7yCmN1kk5InKGuY8NNphKbZ8lPtSXyZ0Z41XjJ+VPhT2E4Lqh1kX3wZO PhRgR1kpRHtcdR7A8xvw2DJS8sqxaVVRcSYm0Nzp+dZrHh5DTV6JmwOBqBzLVQ== 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 8629E24EFD; Wed, 1 Jun 2022 18:53:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 251IrEBJ001083; Wed, 1 Jun 2022 18:53:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 251IrEFX001082; Wed, 1 Jun 2022 18:53:14 GMT (envelope-from git) Date: Wed, 1 Jun 2022 18:53:14 GMT Message-Id: <202206011853.251IrEFX001082@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Alexander Motin Subject: git: 47699fc265b9 - main - hwpmc: Make powerpc memory allocation alike to x86. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: mav X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 47699fc265b9d966b4eba6bc0c41739ac793f52b Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1654109594; 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=UGIv9tirMg7DU3JmIfCUzXbE+FWDT7qPIfDdMpdcI58=; b=dbLSCEG855obtrsH8vzHbH9iOYcSqblHB2493YGD7l9Zq5G/DfZJc+OYR4Tiz9fmYXRw5U jnp3neR4D+0hDAdQWVPAIyiytBlMp5QxN+h5bsUS36lFCtCcom7AJ/lfshoTdQ9wPVPK5s gXrCE0Q4e1Th90YveEjUlHGUDI5GjC+LCNqisO4mvWmj5U1rL6ytIvAuEon8XQV0jtII3I i07l+lnU+PxWRTUduajlTqDdmHkaMG/hg4u2Dg3YfevS1uMWa7DYsLbbjiJDQ5ObNgRHty sPQT33EIbvv3SnFDy8ficHQIHHmbJpdYG8w0Eh9aC2h+d0dbMqXWDD90XMdxlQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1654109594; a=rsa-sha256; cv=none; b=nN1nOBXoMqLOmWT40tESaXX1KcdYapy3cPNOQb2C39HRrcOm/zucY/q0bvbbrGSKOnHww7 2q1lNbrLMV5B1j83X/Y+QouoByvLIkvrxkb69JnT9iXq/vNiL7/mI52/b183j43h/vI35D CPWN7YC4f9CQIB8eMz1TmLE/qEc38efjZoacmfOZDP/xM2vaDALmvKDahgAdW9E1K+/bM0 ArVaefy5C2qAbUz8Ducw5sUYDouUdzBuLEyhP5uGfJGU6JeMSeQtr85cSinzqAuU3FRIse e17PtKQbqYYrQRTXPND5L8WZK6sV6+LvNi7jwnxKs86GIEExFV2FMmct+HkFaA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mav: URL: https://cgit.FreeBSD.org/src/commit/?id=47699fc265b9d966b4eba6bc0c41739ac793f52b commit 47699fc265b9d966b4eba6bc0c41739ac793f52b Author: Alexander Motin AuthorDate: 2022-06-01 18:50:27 +0000 Commit: Alexander Motin CommitDate: 2022-06-01 18:53:04 +0000 hwpmc: Make powerpc memory allocation alike to x86. It should remove some unneeded pointer dereferences. MFC after: 1 month --- sys/dev/hwpmc/hwpmc_powerpc.c | 8 +++----- sys/dev/hwpmc/hwpmc_powerpc.h | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/sys/dev/hwpmc/hwpmc_powerpc.c b/sys/dev/hwpmc/hwpmc_powerpc.c index 8302cfd84992..86ec71f14e80 100644 --- a/sys/dev/hwpmc/hwpmc_powerpc.c +++ b/sys/dev/hwpmc/hwpmc_powerpc.c @@ -167,10 +167,8 @@ powerpc_pcpu_init(struct pmc_mdep *md, int cpu) ("[powerpc,%d] wrong cpu number %d", __LINE__, cpu)); PMCDBG1(MDP,INI,1,"powerpc-init cpu=%d", cpu); - powerpc_pcpu[cpu] = pac = malloc(sizeof(struct powerpc_cpu), M_PMC, - M_WAITOK|M_ZERO); - pac->pc_ppcpmcs = malloc(sizeof(struct pmc_hw) * ppc_max_pmcs, - M_PMC, M_WAITOK|M_ZERO); + powerpc_pcpu[cpu] = pac = malloc(sizeof(struct powerpc_cpu) + + ppc_max_pmcs * sizeof(struct pmc_hw), M_PMC, M_WAITOK | M_ZERO); pac->pc_class = md->pmd_classdep[PMC_MDEP_CLASS_INDEX_POWERPC].pcd_class; @@ -193,8 +191,8 @@ powerpc_pcpu_fini(struct pmc_mdep *md, int cpu) { PMCDBG1(MDP,INI,1,"powerpc-fini cpu=%d", cpu); - free(powerpc_pcpu[cpu]->pc_ppcpmcs, M_PMC); free(powerpc_pcpu[cpu], M_PMC); + powerpc_pcpu[cpu] = NULL; return (0); } diff --git a/sys/dev/hwpmc/hwpmc_powerpc.h b/sys/dev/hwpmc/hwpmc_powerpc.h index 10aa0ad75b14..25b041327b84 100644 --- a/sys/dev/hwpmc/hwpmc_powerpc.h +++ b/sys/dev/hwpmc/hwpmc_powerpc.h @@ -58,8 +58,8 @@ #define PPC_OVERFLOWCNT_MAX 0x200000000UL struct powerpc_cpu { - struct pmc_hw *pc_ppcpmcs; - enum pmc_class pc_class; + enum pmc_class pc_class; + struct pmc_hw pc_ppcpmcs[]; }; struct pmc_ppc_event {