From patchwork Fri Aug 6 12:44:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rosemarie O'Riorden X-Patchwork-Id: 1514342 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.136; helo=smtp3.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=Arcu177e; dkim-atps=neutral Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (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) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4Gh4v273KXz9sW5 for ; Fri, 6 Aug 2021 22:45:02 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 9224F607EB; Fri, 6 Aug 2021 12:45:00 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id tZks7pCqBbdW; Fri, 6 Aug 2021 12:44:59 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp3.osuosl.org (Postfix) with ESMTPS id BADF7605E5; Fri, 6 Aug 2021 12:44:58 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 8C3F8C001A; Fri, 6 Aug 2021 12:44:58 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 7777CC000E for ; Fri, 6 Aug 2021 12:44:57 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 52E9D82F32 for ; Fri, 6 Aug 2021 12:44:57 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Authentication-Results: smtp1.osuosl.org (amavisd-new); dkim=pass (1024-bit key) header.d=redhat.com Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wr8_wKyTj9RE for ; Fri, 6 Aug 2021 12:44:56 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by smtp1.osuosl.org (Postfix) with ESMTPS id 4B43182E22 for ; Fri, 6 Aug 2021 12:44:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628253894; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=yRd/IItn/Y7d/ZD2r+26406Erg5Ei8FQE61TLGIWuI4=; b=Arcu177e2ldIwknbzCAhazPhkL8xh/yhxKS+RPWGFJ8cvadS5n3d/fD2Zbemnwvz4jmMnJ xhaP8tEwrfBJ8Tw86icI0Qed5j5dVbKyNoyUif9XtOcT06sWgo/KentWF+PpXxmul0hkpy EbIbsJszerGqE9lODPbSXDWjdAFnBI4= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-354-IS3zGrlJNSCB8e1VEPXpQQ-1; Fri, 06 Aug 2021 08:44:52 -0400 X-MC-Unique: IS3zGrlJNSCB8e1VEPXpQQ-1 Received: by mail-qk1-f200.google.com with SMTP id 18-20020a05620a0792b02903b8e915ccceso6229243qka.18 for ; Fri, 06 Aug 2021 05:44:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=yRd/IItn/Y7d/ZD2r+26406Erg5Ei8FQE61TLGIWuI4=; b=YBv080MxMO0zDySJ5JucrvxuoXRaShYw4sKkzr5wDK9AdqzGr0nxhiWv8N6WVnbMCI JpgCnpuwLljgTFddd21tWrTthuRe6AapLbolzC9i3o+AHHGf2SolXAOESGhBGEb96vUY XL7GNcV2eEfJfYKyYnpGBcPAjFbOOZgC2S3dUoeMnQhNyXnh9GzxymwvSbpurvZux2KU DPto3dIXyLEWiKCaxRr1sqd5iZX4xLOTr3QkVl7snAsKoF89W0vIRp/rMgWTtnMatwaN +633Jlmud6ReN0VZ02IVaJvP8KeuKzMs0KSm8iaScDcG2E/u0CSfpsPkI+nmEE9tJbt2 sUag== X-Gm-Message-State: AOAM532CQXEF00cruRhT0Xc17xkqAKlxucEMjiKsKbYekzsaO/we3YZA qOcpnX7JAwploC4n1in04aO6DGXwcEDNueBe0f5zLMQSnzQwlrSgTP4ZTstv8cEAZM2Ki122TB3 qzXdBkdIyp/z1+S5lU5lKAqAvmKmZ3jse+hc5aCxEM6xS3ZR9rWMI6cZ6/97B8/YEpD0SqA== X-Received: by 2002:a05:6214:f2e:: with SMTP id iw14mr10881041qvb.36.1628253891759; Fri, 06 Aug 2021 05:44:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxcPdqdNwqkNMQUfvblFRMYSa3FPCMbTPGtEvnmBfWMWNgF9IY4vaTYP6DlnkpWZy7OMUrvfw== X-Received: by 2002:a05:6214:f2e:: with SMTP id iw14mr10881020qvb.36.1628253891507; Fri, 06 Aug 2021 05:44:51 -0700 (PDT) Received: from localhost.net ([2601:18f:903:27d0::e4ea]) by smtp.gmail.com with ESMTPSA id j185sm4607615qkf.28.2021.08.06.05.44.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Aug 2021 05:44:51 -0700 (PDT) From: Rosemarie O'Riorden To: ovs-dev@openvswitch.org Date: Fri, 6 Aug 2021 08:44:32 -0400 Message-Id: <20210806124432.43042-1-roriorde@redhat.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=roriorde@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: Flavio Leitner , Ilya Maximets , David Marchand Subject: [ovs-dev] [PATCH] dpdk: Use --in-memory by default. X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" If anonymous memory mapping is supported by the kernel, it's better to run OVS entirely in memory rather than creating shared data structures. OVS doesn't work in multi-process mode, so there is no need to litter a filesystem and experience random crashes due to old memory chunks stored in re-opened files. When OVS is not running in memory and crashes, it never reaches the clean up scripts that delete the new files it has created, resulting in "dirty" memory. OVS will partially overwrite this memory on the next start-up, but will fail to run again because its filesystem is full of old memory. Here is an example of these crashes: https://inbox.dpdk.org/dev/20200910162407.12669-1-david.marchand@redhat.com/ Reported at: https://bugzilla.redhat.com/show_bug.cgi?id=1949849 Signed-off-by: Rosemarie O'Riorden --- NEWS | 1 + acinclude.m4 | 6 ++++++ lib/dpdk.c | 7 +++++++ 3 files changed, 14 insertions(+) diff --git a/NEWS b/NEWS index 26920e215..515d3cddd 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,7 @@ Post-v2.16.0 by default. 'other_config:dpdk-socket-limit' can be set equal to the 'other_config:dpdk-socket-mem' to preserve the legacy memory limiting behavior. + * EAL argument --in-memory is applied by default if supported. v2.16.0 - xx xxx xxxx diff --git a/acinclude.m4 b/acinclude.m4 index 5a48f0335..7720f2f1b 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -448,6 +448,12 @@ AC_DEFUN([OVS_CHECK_DPDK], [ ], [[#include ]]) ], [], [[#include ]]) + AC_CHECK_DECL([MAP_HUGE_SHIFT], [ + AC_DEFINE([DPDK_IN_MEMORY_SUPPORTED], [1], [If MAP_HUGE_SHIFT is + defined, anonomous memory mapping is supported by the + kernel, and --in-memory can be used.]) + ], [], [[#include ]]) + # DPDK uses dlopen to load plugins. OVS_FIND_DEPENDENCY([dlopen], [dl], [libdl]) diff --git a/lib/dpdk.c b/lib/dpdk.c index b2ef31cd2..97c902fab 100644 --- a/lib/dpdk.c +++ b/lib/dpdk.c @@ -405,6 +405,13 @@ dpdk_init__(const struct smap *ovs_other_config) svec_add(&args, ovs_get_program_name()); construct_dpdk_args(ovs_other_config, &args); +#ifdef DPDK_IN_MEMORY_SUPPORTED + if (!args_contains(&args, "--in-memory") && + !args_contains(&args, "--legacy-mem")) { + svec_add(&args, "--in-memory"); + } +#endif + if (args_contains(&args, "-c") || args_contains(&args, "-l")) { auto_determine = false; }