From nobody Mon Jul 01 13:17:45 2024 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 4WCRRZ0t3gz5Mrwm; Mon, 01 Jul 2024 13:17:46 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WCRRZ0MM0z4kcJ; Mon, 1 Jul 2024 13:17:46 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719839866; 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=izxDYYUkWOej6tLC76qxtxdbnXbct0rwGQoZDECBAg0=; b=JfsUtwwoB/aJzzU8utJXz9vRqN2FMSemWywXTBKBZfXXGdHtGHHMSRR+J1GpE3PwAzeb20 y0u+ydbzt6ywzKt/7/8D7jWHbmlhe9a6t5aUSulXES+CmLbjLb4KewOzS+XJ0MEYNnSHZ0 NYlXeajdCElJxXKuwFKDiv5cXtU458OKjMEE+Gq+YySol0hTGRvLTMHk1S4/fhRGM+A3+p PTAYH47zJkNvH3ZfMpwBxXojAYoDXczNv3hqTtq1ooBycTbtmG0HKHoxLsdNhOC94NPlkZ GfSW1ny0f2eHuW0CE4hRU1qPe8mJHCzpvvYclrCTf4RiGW7LF/fIGleRFRbkOQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1719839866; a=rsa-sha256; cv=none; b=R0vP1qlSqNe+O+cxBlcv0WsfTalHmaKEuVh350xuut5IBL4dxUri8RmplrzYHYeIL1C4Xd 23ofdJQeNlDCySjHBZqoHG8DJmRfJX0VPJcxPGDVaVdI/FGof5zWStVqI4cQl9u1xIeZrI /vEQn3ETkjSruzg6XbqvWhVbdfA+X5NAM6RnWObVIOfnhmpqijsrvgTzlfhMCkcr1dj6Vu AD2HIZYcvm4dSUOk6R41w/GOLtnC2DWRbeIi1VngM89Zz6QnSdiOLrCSqrKBT4+Jk1/K90 UX51Zj0hhXTAVJ7qFerppQaskWEedD7k0f1VND3cvmxWIxCD2Tu9smqeFPvDqg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1719839866; 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=izxDYYUkWOej6tLC76qxtxdbnXbct0rwGQoZDECBAg0=; b=UGNT9tngeuqQmaQp17rCycxV+kddfCXcCYfN1Sne0QpBM9SLMRzdmR1aeJBVAahQf+WaGb fx3dBMdlOAJNt7VYSGgy/4QLn6B6U3e6X/SErNPIqCcV7Pi4V7q8zWctT2cnWyDwN5jGUh h/W49T/M2/nzM3CrKfSmhrfgvImbtdjw7OjiFvebTrAbR+FSHRkubMlddzRVcvf/JqKrX6 AXhcEE5ns/c7FgepibN2W2o98l1VDHZahDIe0xmss1HljJGKOog4pXJPkPOpjDfNUlDO4i mJc7KV0xEQ+V36hnfSKFnssWafx85HC66FkOFJDXvABiL9+vidRu0hBImDYyTQ== 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 4WCRRY6xvZz15ny; Mon, 1 Jul 2024 13:17:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 461DHjcu076864; Mon, 1 Jul 2024 13:17:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 461DHj4x076861; Mon, 1 Jul 2024 13:17:45 GMT (envelope-from git) Date: Mon, 1 Jul 2024 13:17:45 GMT Message-Id: <202407011317.461DHj4x076861@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Wei Hu Subject: git: 840d8e0c306a - stable/14 - amd64: add a func pointer to tlb shootdown function 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: whu X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 840d8e0c306a7f127e4371f6c86213af5764c99b Auto-Submitted: auto-generated The branch stable/14 has been updated by whu: URL: https://cgit.FreeBSD.org/src/commit/?id=840d8e0c306a7f127e4371f6c86213af5764c99b commit 840d8e0c306a7f127e4371f6c86213af5764c99b Author: Souradeep Chakrabarti AuthorDate: 2024-06-05 12:25:05 +0000 Commit: Wei Hu CommitDate: 2024-07-01 13:03:02 +0000 amd64: add a func pointer to tlb shootdown function Make the tlb shootdown function as a pointer. By default, it still points to the system function smp_targeted_tlb_shootdown(). It allows other implemenations to overwrite in the future. Reviewed by: kib Tested by: whu Authored-by: Souradeep Chakrabarti Co-Authored-by: Erni Sri Satya Vennela MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D45174 (cherry picked from commit bec000c9c1ef409989685bb03ff0532907befb4a) --- sys/amd64/amd64/mp_machdep.c | 27 ++++++--------------------- sys/vm/pmap.h | 27 +++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 21 deletions(-) diff --git a/sys/amd64/amd64/mp_machdep.c b/sys/amd64/amd64/mp_machdep.c index d506ffada4b9..91737637b714 100644 --- a/sys/amd64/amd64/mp_machdep.c +++ b/sys/amd64/amd64/mp_machdep.c @@ -102,13 +102,16 @@ void *bootpcpu; extern u_int mptramp_la57; extern u_int mptramp_nx; - +smp_targeted_tlb_shootdown_t smp_targeted_tlb_shootdown = &smp_targeted_tlb_shootdown_native; /* * Local data and functions. */ static int start_ap(int apic_id, vm_paddr_t boot_address); +void +smp_targeted_tlb_shootdown_native(pmap_t pmap, vm_offset_t addr1, vm_offset_t addr2, + smp_invl_cb_t curcpu_cb, enum invl_op_codes op); /* * Initialize the IPI handlers and start up the AP's. */ @@ -497,24 +500,6 @@ start_ap(int apic_id, vm_paddr_t boot_address) * Flush the TLB on other CPU's */ -/* - * Invalidation request. PCPU pc_smp_tlb_op uses u_int instead of the - * enum to avoid both namespace and ABI issues (with enums). - */ -enum invl_op_codes { - INVL_OP_TLB = 1, - INVL_OP_TLB_INVPCID = 2, - INVL_OP_TLB_INVPCID_PTI = 3, - INVL_OP_TLB_PCID = 4, - INVL_OP_PGRNG = 5, - INVL_OP_PGRNG_INVPCID = 6, - INVL_OP_PGRNG_PCID = 7, - INVL_OP_PG = 8, - INVL_OP_PG_INVPCID = 9, - INVL_OP_PG_PCID = 10, - INVL_OP_CACHE = 11, -}; - /* * These variables are initialized at startup to reflect how each of * the different kinds of invalidations should be performed on the @@ -600,8 +585,8 @@ invl_scoreboard_slot(u_int cpu) * Function must be called with the thread pinned, and it unpins on * completion. */ -static void -smp_targeted_tlb_shootdown(pmap_t pmap, vm_offset_t addr1, vm_offset_t addr2, +void +smp_targeted_tlb_shootdown_native(pmap_t pmap, vm_offset_t addr1, vm_offset_t addr2, smp_invl_cb_t curcpu_cb, enum invl_op_codes op) { cpuset_t mask; diff --git a/sys/vm/pmap.h b/sys/vm/pmap.h index 65e909df9b8f..f438a1bd0883 100644 --- a/sys/vm/pmap.h +++ b/sys/vm/pmap.h @@ -169,6 +169,33 @@ void pmap_unwire(pmap_t pmap, vm_offset_t start, vm_offset_t end); void pmap_zero_page(vm_page_t); void pmap_zero_page_area(vm_page_t, int off, int size); +/* + * Invalidation request. PCPU pc_smp_tlb_op uses u_int instead of the + * enum to avoid both namespace and ABI issues (with enums). + */ +enum invl_op_codes { + INVL_OP_TLB = 1, + INVL_OP_TLB_INVPCID = 2, + INVL_OP_TLB_INVPCID_PTI = 3, + INVL_OP_TLB_PCID = 4, + INVL_OP_PGRNG = 5, + INVL_OP_PGRNG_INVPCID = 6, + INVL_OP_PGRNG_PCID = 7, + INVL_OP_PG = 8, + INVL_OP_PG_INVPCID = 9, + INVL_OP_PG_PCID = 10, + INVL_OP_CACHE = 11, +}; +typedef void (*smp_invl_local_cb_t)(struct pmap *, vm_offset_t addr1, + vm_offset_t addr2); +typedef void (*smp_targeted_tlb_shootdown_t)(pmap_t, vm_offset_t, vm_offset_t, + smp_invl_local_cb_t, enum invl_op_codes); + +extern void +smp_targeted_tlb_shootdown_native(pmap_t, vm_offset_t, vm_offset_t, + smp_invl_local_cb_t, enum invl_op_codes); +extern smp_targeted_tlb_shootdown_t smp_targeted_tlb_shootdown; + #define pmap_resident_count(pm) ((pm)->pm_stats.resident_count) #define pmap_wired_count(pm) ((pm)->pm_stats.wired_count)