From patchwork Tue May 2 03:15:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tyler Retzlaff X-Patchwork-Id: 126643 Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CD95342A38; Tue, 2 May 2023 05:16:05 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C2AFE42D29; Tue, 2 May 2023 05:15:49 +0200 (CEST) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 6D2A3406A2 for ; Tue, 2 May 2023 05:15:44 +0200 (CEST) Received: by linux.microsoft.com (Postfix, from userid 1086) id AC87121C3F18; Mon, 1 May 2023 20:15:43 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com AC87121C3F18 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1682997343; bh=TZbqhTBE/JPpiYN434AAvDiNpHY6vv7c6cBvhu6T1w8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kjO60wf2HWumGz7KDmReA2wg7cH1X39G7Sp1HkxK0Ed278S/pt4LUY6xWB6/TKhgd lRpEnfTt786n92L5acQgErV4WxtVABzlO2zFzARLAwT2ieTNHmY6SF/9USSL/axHGD DJNp5H9uaKaxbzl49Qkgs+vyB/wYXBQrr2V9jJ9k= From: Tyler Retzlaff To: dev@dpdk.org Cc: bruce.richardson@intel.com, david.marchand@redhat.com, thomas@monjalon.net, mb@smartsharesystems.com, konstantin.ananyev@huawei.com, Tyler Retzlaff Subject: [PATCH v8 00/14] msvc integration changes Date: Mon, 1 May 2023 20:15:27 -0700 Message-Id: <1682997341-2271-1-git-send-email-roretzla@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> References: <1680558751-17931-1-git-send-email-roretzla@linux.microsoft.com> MIME-Version: 1.0 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org In accordance with draft plan http://mails.dpdk.org/archives/web/2023-February/002023.html introduces conditionally compiled code to enable building with MSVC that _does not_ require C99/C11 meaning it can be integrated now. This series covers minimal changes for item #2 in draft plan for EAL dependencies kvargs, telemetry and consumed EAL public headers. Note if any patch in the series requires in-depth discussion I'll detach it from this series for separate submission & more focused discussion so it doesn't block the entire series. Note other "common" intrinsics were investigated for viability but were not adopted either because they were not available on older versions of gcc or because they generate different code for msvc vs gcc. v8: * use waitpkg intrinsics if __WAITPKG__ is defined by the compiler v7: * remove patch typedef of rte_cpuflags_t as an int. for now we will just allow warning to be emitted to avoid adding conditional compilation v6: * convert / expand likely/unlikely macros to _Bool type * expand __extension__ empty it's cleaner to do this for now instead of modifying the whole tree * provide msvc container_of not based on gcc expression statement extension * add patch that stops defining typeof (C23 keyword) when building with msvc v5: * remove accidental line removal in barrier patch * update prefetch patch to use intrinsics for all toolchains * remove x86 specific changes for byte swap patch since msvc intrinsics are processor agnostic always use intrinsics from generic include * expand __rte_packed empty for msvc packing will be addressed in a separate series v4: * update rdtsc patch to use gcc intrinsics * update rtm patch to use gcc intrinsics * drop patch disable json print formatting, we will utilize series removing VLAs from Bruce * added patch using prefetch intrinsics for msvc * added patch using byte swap intrinsics for msvc * added patch hiding typdefs for msvc using gcc vector extension * added patch defining MSVC as little endian always v3: * v3 does not group together conditional blocks when experimented with it didn't reduce conditionals enough to make it worth while. once msvc tests are at a running point i suggest a narrow targeted discussion about code organization without blocking this series * v3 does not attempt to refactor to use intrinsics for non-msvc compilers. again this should be done as a separate follow-up series later if desired * fix expansion of likely and unlikely macros * remove unnecessary define for rte_smp_{r,w}mb it is sufficient for these to be compiler barriers on x86 * add a new patch to use __cpuid and __cpuidex intrinsics when building with msvc * add a new patch to use _umonitor, _umwait and _tpause intrinsics when building with msvc v2: * use _mm_{l,s,m}fence intrinsics for rte_smp_{r,w,}mb macros are intended to be memory barriers not compiler barriers on x86_64 Tyler Retzlaff (14): eal: use rdtsc intrinsic eal: use rtm and xtest intrinsics eal: use barrier intrinsics eal: use cpuid and cpuidex intrinsics eal: use umonitor umwait and tpause intrinsics eal: use prefetch intrinsics eal: use byte swap intrinsics eal: hide GCC extension based alignment markers eal: hide typedefs based on GCC vector extensions eal: expand most macros to empty when using MSVC eal: exclude exposure of rte atomic APIs for MSVC builds telemetry: avoid expanding versioned symbol macros on MSVC eal: always define MSVC as little endian eal: do not define typeof macro when building with MSVC config/x86/meson.build | 6 ++++ lib/eal/include/generic/rte_atomic.h | 11 ++++++ lib/eal/include/generic/rte_byteorder.h | 13 +++++++ lib/eal/include/generic/rte_vect.h | 4 +++ lib/eal/include/rte_branch_prediction.h | 8 +++++ lib/eal/include/rte_common.h | 60 +++++++++++++++++++++++++++++++++ lib/eal/include/rte_compat.h | 20 +++++++++++ lib/eal/x86/include/rte_atomic.h | 8 +++++ lib/eal/x86/include/rte_byteorder.h | 4 +++ lib/eal/x86/include/rte_cycles.h | 14 ++++---- lib/eal/x86/include/rte_prefetch.h | 25 +++++++++++--- lib/eal/x86/include/rte_rtm.h | 18 +++------- lib/eal/x86/rte_cpuflags.c | 4 +++ lib/eal/x86/rte_cpuid.h | 7 ++++ lib/eal/x86/rte_cycles.c | 36 ++++++++++++++++++++ lib/eal/x86/rte_hypervisor.c | 4 +++ lib/eal/x86/rte_power_intrinsics.c | 12 +++++++ lib/telemetry/telemetry_data.c | 16 +++++++++ 18 files changed, 247 insertions(+), 23 deletions(-)