Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3072757imm; Mon, 24 Sep 2018 15:23:54 -0700 (PDT) X-Google-Smtp-Source: ACcGV605EeIi6Ve7OlUDIqn5clYQIxEYzwAdpUKl9A/uKjyOOf3bp3M8FiC/AQ122zPVEUVp/orF X-Received: by 2002:a17:902:209:: with SMTP id 9-v6mr679589plc.270.1537827833999; Mon, 24 Sep 2018 15:23:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537827833; cv=none; d=google.com; s=arc-20160816; b=LIIoYr/Gl1GoAIfnUrZnW2IaT+ZVZPUnKialzFAy0iZXBW3FnmIJgfkWJVBaVEFsAM cDHAUJrnUpGAE+b8P65IAJZ2lKZhxTR1jpaqOi4oZMJk5aj0KUrpphh7Y3K2yIg0lIT0 9PHZBNk34oTgrO0K28O8w5hWQf5nDEMgxAh/Yn0Httxn8rPd0/Zo/13oPFFw5eSGiaCH CuT306oZmBjIUDmfbST0GC3FHV/Bt1UMWY3ewdDCqRva8j6jcNu7TAeFKkXb0x4ZOdwU Sn8LZYK2uAgzJ3bLZHltRe5SQ+rGACqeHcCYRDN+wgFlChTBT/tMosS/iFOHeR8zbKQS Jn/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=s3z94BMobiA9YFxSIqzmpHzQ4VVHsuRsQ9FQW7p2ODU=; b=A6V3WHQX6Of3CKnDfR4GFh7+hfqgmP92F2IVAjujEQKWI5x4j8h24Yie9fNGKm2gyY QlGTAHvAnT4j3ArarAvW6yHwrHYfzXR4qB49vNpFiZvbwKKJhxNREFv5RHz4MJQRrVlm TdSePduXHLi2VBxJ/hvGgyOEiV6xjDfcZBvsjOdchq48OQSI69CRXM8zk3VB4xInkun/ sWJDMbx/oqv564EQkz1UexCGJniVrcFYDN3GWPX4iXeSDZMZYwxpGtHJA22zCBLNorMh GSLmF0NEDhbq/jznrPoCyUamHO+kfQWVYVC9RWlEcj+BSmMH2eFI674JJceWaoC29x2r k16A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h9-v6si495469pgk.121.2018.09.24.15.23.39; Mon, 24 Sep 2018 15:23:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727690AbeIYE0c convert rfc822-to-8bit (ORCPT + 99 others); Tue, 25 Sep 2018 00:26:32 -0400 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:58027 "EHLO relay5-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726161AbeIYE0c (ORCPT ); Tue, 25 Sep 2018 00:26:32 -0400 X-Originating-IP: 99.0.85.34 Received: from jarnos-mbp.lan (unknown [99.0.85.34]) (Authenticated sender: jarno@ovn.org) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 649D11C0007; Mon, 24 Sep 2018 22:22:03 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: [Regression] openvswitch: Add eventmask support to CT action. From: Jarno Rajahalme In-Reply-To: <0d69e5b1-ac17-52c4-04f9-34ad1eb9f2eb@canonical.com> Date: Mon, 24 Sep 2018 15:21:59 -0700 Cc: gvrose8192@gmail.com, joe@ovn.org, davem@davemloft.net, pshelar@ovn.org, netdev@vger.kernel.org, ovs dev , "linux-kernel@vger.kernel.org" , james.page@canonical.com, christian.ehrhardt@canonical.com, 1736390@bugs.launchpad.net Content-Transfer-Encoding: 8BIT Message-Id: References: <0d69e5b1-ac17-52c4-04f9-34ad1eb9f2eb@canonical.com> To: Joseph Salisbury X-Mailer: Apple Mail (2.3273) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > On Sep 21, 2018, at 2:37 AM, Joseph Salisbury wrote: > > Hi Jarno, > > A kernel bug report was opened against Ubuntu [0]. This bug is a > regression introduced in v4.12-rc1. The latest mainline kernel was > tested and still exhibits the bug. The following commit was identified > as the cause of the regression: > > 120645513f55 ("openvswitch: Add eventmask support to CT action.") > > I was hoping to get your feedback, since you are the patch author. Do > you think gathering any additional data will help diagnose this issue? > > > Thanks, > > Joe > > http://pad.lv/1736390 > I spent a while looking what could cause an i386-only issue like reported due to this commit, but could not come up with anything solid. Essentially the commit is setting the ‘ctmask’ field of a CT eceche extension. The purpose of the ‘ctmask’ is to limit the type of conntrack events for which a report Is delivered to any monitors in userspace. With a non-default (default is all-ones) ‘ctmask’ the code paths taken in nf_conntrack_eventmask_report() and nf_ct_deliver_cached_events() are changed to skip the generation of event reports for some event types. While it is hard to see how this could manifest as a bug in i386, this should be the only effect of the commit referred to above. OVS probes for the kernel support of this feature and only uses the OVS_CT_ATTR_EVENTMASK attribute if support for it in the kernel is detected. The option of reverting the commit will cause additional CPU use and potential buffering issues for CT event monitors in userspace. If you need to revert the commit please try to do so only for the affected architecture (i386). However, while reviewing all the uses of ‘ctmask’ and the associated nf_ct_ecache_ext_add() calls in the kernel with Joe we figured it would be worth trying a change where ‘ctmask’ is set in the CT template instead on the actual CT entry directly. This is a long shot in the sense of changing the behavior, but the only thing we could come up now. I have attached the patch below, please try it in your test rig. commit a717743bd355b3a25a83b196403db9d010b311b2 (HEAD -> ovs-set-ctmask-in-template) Author: Jarno Rajahalme Date: Mon Sep 24 14:34:26 2018 -0700 openvswitch: Set CT mask in template Set the conntrack event mask in the template rather than on the conntrack entry itself. init_conntrack() (called via nf_conntrack_in()) will pick the event mask from the template. Signed-off-by: Jarno Rajahalme diff --git a/net/openvswitch/conntrack.c b/net/openvswitch/conntrack.c index 86a75105af1a..ae1fb06828da 100644 --- a/net/openvswitch/conntrack.c +++ b/net/openvswitch/conntrack.c @@ -1169,21 +1169,6 @@ static int ovs_ct_commit(struct net *net, struct sw_flow_key *key, } } #endif - - /* Set the conntrack event mask if given. NEW and DELETE events have - * their own groups, but the NFNLGRP_CONNTRACK_UPDATE group listener - * typically would receive many kinds of updates. Setting the event - * mask allows those events to be filtered. The set event mask will - * remain in effect for the lifetime of the connection unless changed - * by a further CT action with both the commit flag and the eventmask - * option. */ - if (info->have_eventmask) { - struct nf_conntrack_ecache *cache = nf_ct_ecache_find(ct); - - if (cache) - cache->ctmask = info->eventmask; - } - /* Apply changes before confirming the connection so that the initial * conntrack NEW netlink event carries the values given in the CT * action. @@ -1625,6 +1610,20 @@ int ovs_ct_copy_action(struct net *net, const struct nlattr *attr, return -ENOMEM; } + /* Set the conntrack event mask if given. NEW and DELETE events have + * their own groups, but the NFNLGRP_CONNTRACK_UPDATE group listener + * typically would receive many kinds of updates. Setting the event + * mask allows those events to be filtered. The set event mask will + * remain in effect for the lifetime of the connection unless changed + * by a further CT action with both the commit flag and the eventmask + * option. */ + if (ct_info.have_eventmask) { + if (!nf_ct_ecache_ext_add(ct_info.ct, ct_info.eventmask, 0, GFP_KERNEL)) { + OVS_NLERR(log, "Failed to allocate ecache for conntrack template"); + return -ENOMEM; + } + } + __set_bit(IPS_CONFIRMED_BIT, &ct_info.ct->status); nf_conntrack_get(&ct_info.ct->ct_general);