From patchwork Tue Apr 17 19:34:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Rose X-Patchwork-Id: 899611 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="cp7p5b7i"; dkim-atps=neutral Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40Qb6L4tSpz9s1d for ; Wed, 18 Apr 2018 05:34:18 +1000 (AEST) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 6C24BCB6; Tue, 17 Apr 2018 19:34:14 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 63FB44A4 for ; Tue, 17 Apr 2018 19:34:13 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.7.6 Received: from mail-pl0-f49.google.com (mail-pl0-f49.google.com [209.85.160.49]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id D00A8557 for ; Tue, 17 Apr 2018 19:34:12 +0000 (UTC) Received: by mail-pl0-f49.google.com with SMTP id t20-v6so12554931ply.9 for ; Tue, 17 Apr 2018 12:34:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=0CaHwNzU0xREAcELxI+GjIRoI0uNbNcqNb91FNdm9xQ=; b=cp7p5b7ijefNZo3Q3XRoCWaxNnIdcYW3lGNq8WoPNhWiyAU0h0NssMUd9xRfPnH3tU R8vL66HJgNy9DgklOg5am2/XBy/YFFDJhM5MAxY/6CdzAbvLm3MII+t5UNsV3SS2haji YFUsLbZVvdJDqV110dmJGQdA3dm4OIEtG6t42QeEY8EKbn+VZVkXrV5FKdA/QDe0qbIY tVcF68qK64fHUcWD/oOttaGn1L6piAQ4fsWp/4MbcjW0/45C2t0HGmWlWXfesNOlb1Zx flkyfLTX6+/0mH4WVsYrIQd8uUHY+JNQOeRcfIt8WN99TWznjPk3yCLEOp5PCTZX7Lhl fK3w== 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; bh=0CaHwNzU0xREAcELxI+GjIRoI0uNbNcqNb91FNdm9xQ=; b=XXYhjcZyb8EVsOZs5F7wBpWXovQ5CLL2RMLMkOUJQ+BQsFUui63j33vT/rQVkCe2li WYn/3fgWweoqVd6xsft+HJeQDu4K5Vz7U8H63O/hKjk9lxawzCXIeBeZz8TVWnEvefjm hciRnkIu0de2yndFY5QsyfrJjU4vFdGRdecsZRPIz+mtpHksE7Oq//g7uok2JRC+Ov7p IITcBm+32KOZG41kmffgyEOSu2w3KCxV+g36Kzg5j+lQvIgmSP/+UGxnCRbO7NYZnBSg iLQ/YsdSPhjrFoj1VRw2F37DRHFPci4pWTgqAO3ZSZd6f/evfpQHq0OqWt+cxKLah+fp oL6A== X-Gm-Message-State: ALQs6tAgxd+Tf6eJnhG/zlIe1ovqZUgSOhivYdspi+hGoxn7br9yujRD aCCLVs/pI6WuoeWKzvAAIzcTDg== X-Google-Smtp-Source: AIpwx48Xi7jhLtO36SrRUwD8ww4BAsbjWyMxaICYCp8Zak/EkfGEFEOVcKJ+pMuHyYWRjTaIJjjSHQ== X-Received: by 2002:a17:902:be15:: with SMTP id r21-v6mr3092920pls.237.1523993651662; Tue, 17 Apr 2018 12:34:11 -0700 (PDT) Received: from gizo.domain (67-5-146-204.ptld.qwest.net. [67.5.146.204]) by smtp.gmail.com with ESMTPSA id c186sm26961899pfb.40.2018.04.17.12.34.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Apr 2018 12:34:10 -0700 (PDT) From: Greg Rose To: dev@openvswitch.org Date: Tue, 17 Apr 2018 12:34:08 -0700 Message-Id: <1523993648-22179-1-git-send-email-gvrose8192@gmail.com> X-Mailer: git-send-email 1.8.3.1 X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE autolearn=no version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: fbl@sysclose.org Subject: [ovs-dev] [PATCH V2] datapath: Prevent panic X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org On RHEL 7.x kernels we observe a panic induced by a paging error when the timer kicks off a job that subsequently accesses memory that belonged to the openvswitch kernel module but was since unloaded - thus the paging error. The panic can be induced on any RHEL 7.x kernel with the following test: while `true` do make check-kmod TESTSUITEFLAGS="-k \!gre" done On the systems I've been testing on it generally takes anywhere from a minute to 15 minutes or so to repro but never longer than that. Similar results have been seen by other testers. This patch does not fix the underlying bug, which does need to be investigated and fixed, but it does prevent it from occurring. We would like to prevent customer systems from panicking while we do futher investigation to find the root cause. Here is the trace: [252257.801809] BUG: unable to handle kernel paging request at ffffffffc07c6298 [252257.802451] IP: [] run_timer_softirq+0xe0/0x310 [252257.803055] PGD 19f5067 PUD 19f7067 PMD 2fb5fc2067 PTE 0 [252257.803559] Oops: 0002 [#1] SMP [252257.804138] Modules linked in: geneve ip6_udp_tunnel xt_statistic xt_physdev xt_nat xt_recent xt_comment xt_mark ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat xt_addrtype ipt_REJECT nf_reject_ipv4 xt_conntrack iptable_filter ip_tables nf_conntrack_netlink br_netfilter overlay(T) sch_htb veth udp_tunnel 8021q garp mrp tun ip_set nfnetlink bridge stp llc nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack iTCO_wdt iTCO_vendor_support dcdbas mxm_wmi sb_edac edac_core intel_powerclamp coretemp intel_rapl iosf_mbi kvm_intel kvm irqbypass crc32_pclmul ghash_clmulni_intel aesni_intel lrw gf128mul glue_helper ablk_helper cryptd joydev mei_me sg mei ipmi_ssif pcspkr shpchp lpc_ich ipmi_si ipmi_devintf ipmi_msghandler acpi_power_meter wmi nfsd auth_rpcgss [252257.808079] nfs_acl lockd grace sunrpc xfs libcrc32c sr_mod sd_mod cdrom crc_t10dif crct10dif_generic uas usb_storage mgag200 drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ttm drm crct10dif_pclmul crct10dif_common crc32c_intel ahci libahci ixgbe libata igb megaraid_sas mdio ptp i2c_algo_bit pps_core i2c_core dca dm_mirror dm_region_hash dm_log dm_mod [last unloaded: openvswitch] [252257.811056] CPU: 33 PID: 0 Comm: swapper/33 Tainted: G OE ------------ T 3.10.0-693.el7.x86_64 #1 [252257.811826] Hardware name: Dell Inc. PowerEdge R630/02C2CP, BIOS 2.1.5 04/11/2016 [252257.812605] task: ffff8830b7708fd0 ti: ffff8830b7718000 task.ti: ffff8830b7718000 [252257.813447] RIP: 0010:[] [] run_timer_softirq+0xe0/0x310 [252257.814298] RSP: 0018:ffff885fbe203e68 EFLAGS: 00010082 [252257.815122] RAX: ffff8830b66bc838 RBX: ffff8830b66bc000 RCX: ffffffffc07c6290 [252257.815933] RDX: ffff8830b66bc810 RSI: ffff885fbe203e90 RDI: ffff8830b66bc000 [252257.816733] RBP: ffff885fbe203ed0 R08: 0000e56b5701d800 R09: ffff885fbe203da0 [252257.817568] R10: 0000000000000002 R11: ffff885fbe203da8 R12: 0000000000000081 [252257.818429] R13: 0000e56b56fb2eca R14: ffffffff819eb0c8 R15: 0000000000000001 [252257.819297] FS: 0000000000000000(0000) GS:ffff885fbe200000(0000) knlGS:0000000000000000 [252257.820174] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [252257.821156] CR2: ffffffffc07c6298 CR3: 00000000019f2000 CR4: 00000000003407e0 [252257.822012] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [252257.822869] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [252257.823720] Stack: [252257.824678] ffff8830b66bdc28 ffff8830b66bd828 ffff8830b66bd428 ffff8830b66bd028 [252257.825699] ffff885fbe20fe80 ffff885fbe203eb0 ffffffff8132bfe0 28a56c277c4fe974 [252257.826623] 0000000000000001 0000000000000001 0000e56b56fb2eca ffffffff819eb0c8 [252257.827524] Call Trace: [252257.828410] [252257.828417] [252257.829292] [] ? timerqueue_add+0x60/0xb0 [252257.830164] [] __do_softirq+0xef/0x280 [252257.831010] [] call_softirq+0x1c/0x30 [252257.831849] [] do_softirq+0x65/0xa0 [252257.832669] [] irq_exit+0x105/0x110 [252257.833501] [] smp_apic_timer_interrupt+0x42/0x50 [252257.834330] [] apic_timer_interrupt+0x6d/0x80 [252257.835152] [252257.835159] [252257.835944] [] ? cpuidle_enter_state+0x52/0xc0 [252257.837231] [] cpuidle_idle_call+0xd8/0x210 [252257.838224] [] arch_cpu_idle+0xe/0x30 [252257.839133] [] cpu_startup_entry+0x14a/0x1c0 [252257.839933] [] start_secondary+0x1b6/0x230 [252257.840684] Code: 00 00 00 44 0f b6 e0 45 85 e4 0f 84 a7 01 00 00 49 63 d4 48 83 43 10 01 48 8d 75 c0 48 c1 e2 04 48 01 da 48 8b 4a 28 48 8d 42 28 <48> 89 71 08 48 89 4d c0 48 8b 4a 30 48 89 4d c8 48 89 31 48 89 [252257.842366] RIP [] run_timer_softirq+0xe0/0x310 [252257.843183] RSP [252257.843955] CR2: ffffffffc07c6298 Signed-off-by: Greg Rose --- V2 - Add splat to commit message per Pravin's request --- datapath/datapath.c | 10 ++++++++++ tests/system-kmod-macros.at | 1 + utilities/ovs-lib.in | 1 + 3 files changed, 12 insertions(+) diff --git a/datapath/datapath.c b/datapath/datapath.c index 3ea240a..43f0d74 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -2478,6 +2478,16 @@ error: static void dp_cleanup(void) { +#if RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(8,0) + /* On RHEL 7.x kernels we hit a kernel paging error without + * this barrier and subsequent hefty delay. A process will + * attempt to access openvwitch memory after it has been + * unloaded. Further debugging is needed on that but for + * now let's not let customer machines panic. + */ + rcu_barrier(); + msleep(3000); +#endif dp_unregister_genl(ARRAY_SIZE(dp_genl_families)); ovs_netdev_exit(); unregister_netdevice_notifier(&ovs_dp_device_notifier); diff --git a/tests/system-kmod-macros.at b/tests/system-kmod-macros.at index f23a406..2b9b691 100644 --- a/tests/system-kmod-macros.at +++ b/tests/system-kmod-macros.at @@ -23,6 +23,7 @@ m4_define([OVS_TRAFFIC_VSWITCHD_START], on_exit 'modprobe -q -r mod' ]) on_exit 'ovs-dpctl del-dp ovs-system' + on_exit 'ovs-appctl dpctl/flush-conntrack' _OVS_VSWITCHD_START([]) dnl Add bridges, ports, etc. AT_CHECK([ovs-vsctl -- _ADD_BR([br0]) -- $1 m4_if([$2], [], [], [| uuidfilt])], [0], [$2]) diff --git a/utilities/ovs-lib.in b/utilities/ovs-lib.in index 4dc3151..4c3ad0f 100644 --- a/utilities/ovs-lib.in +++ b/utilities/ovs-lib.in @@ -616,6 +616,7 @@ force_reload_kmod () { for dp in `ovs-dpctl dump-dps`; do action "Removing datapath: $dp" ovs-dpctl del-dp "$dp" done + action "ovs-appctl dpctl/flush-conntrack" for vport in `awk '/^vport_/ { print $1 }' /proc/modules`; do action "Removing $vport module" rmmod $vport