* Re: [PATCH] smsc911x: power-up phydev before doing a software reset.
From: Javier Martinez Canillas @ 2014-11-13 8:27 UTC (permalink / raw)
To: Enric Balletbo Serra
Cc: David Miller, netdev, Steve Glendinning, Enrico Butera
In-Reply-To: <CAFqH_50cpvdvCgD-=HQDZ1OT9vmzWkExNHzoASNaruSKLnJZBA@mail.gmail.com>
Hello Enric,
On Thu, Nov 13, 2014 at 8:57 AM, Enric Balletbo Serra
<eballetbo@gmail.com> wrote:
>
> Yes, I'm agree. I'll send version 2 of the patch changing this. Also
> there are other places that use the mdelay family intead of
> usleep_range() and can only be invoked from process context. Maybe
> would be interesting send another patch changing this.
>
Agreed, that could be a separate patch though.
Also there is a mdelay(100) before enabling energy detect mode in
smsc911x_phy_enable_energy_detect() which I believe can be removed.
Best regards,
Javier
^ permalink raw reply
* [PATCH] ixgbe: make VLAN filter conditional in SR-IOV case
From: Hiroshi Shimamoto @ 2014-11-13 8:28 UTC (permalink / raw)
To: e1000-devel@lists.sourceforge.net
Cc: netdev@vger.kernel.org, Choi, Sy Jong, Hayato Momma,
linux-kernel@vger.kernel.org
From: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
Disable hardware VLAN filtering if netdev->features VLAN flag is dropped.
In SR-IOV case, there is a use case which needs to disable VLAN filter.
For example, we need to make a network function with VF in virtualized
environment. That network function may be a software switch, a router
or etc. It means that that network function will be an end point which
terminates many VLANs.
In the current implementation, VLAN filtering always be turned on and
VF can receive only 63 VLANs. It means that only 63 VLANs can be used
and it's not enough at all for building a virtual router.
With this patch, if the user turns VLAN filtering off on the host, VF
can receive every VLAN packet.
The behavior is changed only if VLAN filtering is turned off by ethtool.
Signed-off-by: Hiroshi Shimamoto <h-shimamoto@ct.jp.nec.com>
CC: Choi, Sy Jong <sy.jong.choi@intel.com>
---
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 10 ++++++++++
drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 4 ++++
2 files changed, 14 insertions(+)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index d2df4e3..91ce3a8 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -3948,6 +3948,12 @@ void ixgbe_set_rx_mode(struct net_device *netdev)
hw->addr_ctrl.user_set_promisc = false;
}
+ /* Disable hardware VLAN filter if the feature flag is dropped */
+ if (!(netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) {
+ dev_info(&adapter->pdev->dev, "Disable HW VLAN filter\n");
+ vlnctrl &= ~(IXGBE_VLNCTRL_VFE | IXGBE_VLNCTRL_CFIEN);
+ }
+
/*
* Write addresses to available RAR registers, if there is not
* sufficient space to store all the addresses then enable
@@ -7634,6 +7640,10 @@ static int ixgbe_set_features(struct net_device *netdev,
else
ixgbe_vlan_strip_disable(adapter);
+ /* reset if HW VLAN filter is changed */
+ if (changed & NETIF_F_HW_VLAN_CTAG_FILTER)
+ need_reset = true;
+
if (changed & NETIF_F_RXALL)
need_reset = true;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index 13916d8..5508d8a 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -776,6 +776,10 @@ static int ixgbe_set_vf_vlan_msg(struct ixgbe_adapter *adapter,
u32 bits;
u8 tcs = netdev_get_num_tc(adapter->netdev);
+ /* Ignore if VLAN filter is disabled */
+ if (!(adapter->netdev->features & NETIF_F_HW_VLAN_CTAG_FILTER))
+ return 0;
+
if (adapter->vfinfo[vf].pf_vlan || tcs) {
e_warn(drv,
"VF %d attempted to override administratively set VLAN configuration\n"
--
1.9.0
------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel® Ethernet, visit http://communities.intel.com/community/wired
^ permalink raw reply related
* Re: [PATCH 1/2] virito: introduce methods of fixing device features
From: Cornelia Huck @ 2014-11-13 8:46 UTC (permalink / raw)
To: Jason Wang; +Cc: netdev, virtualization, linux-kernel, mst
In-Reply-To: <1415857974-23326-1-git-send-email-jasowang@redhat.com>
On Thu, 13 Nov 2014 13:52:53 +0800
Jason Wang <jasowang@redhat.com> wrote:
typo in subject-prefix: s/virito/virtio/
> Buggy host may advertised buggy host features (a usual case is that host
> advertise a feature whose dependencies were missed). In this case, driver
> should detect and disable the buggy features by itself.
>
> This patch introduces driver specific fix_features() method which is called
> just before features finalizing to detect and disable buggy features
> advertised by host.
So the basic problem this patch fixes is that an individual driver may
only specify a static set of features but cannot specify any
dependencies, right? Adding a sanitizer step makes sense, I guess.
>
> Virtio-net will be the first user.
>
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
> drivers/virtio/virtio.c | 4 ++++
> include/linux/virtio.h | 1 +
> include/linux/virtio_config.h | 12 ++++++++++++
> 3 files changed, 17 insertions(+)
>
> diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
> index df598dd..7001d6e 100644
> --- a/drivers/virtio/virtio.c
> +++ b/drivers/virtio/virtio.c
> @@ -181,6 +181,10 @@ static int virtio_dev_probe(struct device *_d)
> if (device_features & (1 << i))
> set_bit(i, dev->features);
>
> + /* Fix buggy features advertised by host */
> + if (drv->fix_features)
> + drv->fix_features(dev);
I'd probably call this "sanitize_features" instead.
> +
> dev->config->finalize_features(dev);
>
> err = drv->probe(dev);
> diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
> index 7f4ef66..7bd89ea 100644
> --- a/include/linux/virtio_config.h
> +++ b/include/linux/virtio_config.h
> @@ -96,6 +96,18 @@ static inline bool virtio_has_feature(const struct virtio_device *vdev,
> return test_bit(fbit, vdev->features);
> }
>
> +static inline void virtio_disable_feature(struct virtio_device *vdev,
> + unsigned int fbit)
> +{
> + BUG_ON(fbit >= VIRTIO_TRANSPORT_F_START);
> + BUG_ON(vdev->config->get_status(vdev) &
> + ~(VIRTIO_CONFIG_S_ACKNOWLEDGE | VIRTIO_CONFIG_S_DRIVER));
When we add virtio-1 support, we can add a check for FEATURES_OK here,
so we're really on the safe side.
> +
> + virtio_check_driver_offered_feature(vdev, fbit);
> +
> + clear_bit(fbit, vdev->features);
> +}
> +
> static inline
> struct virtqueue *virtio_find_single_vq(struct virtio_device *vdev,
> vq_callback_t *c, const char *n)
The approach looks good to me.
^ permalink raw reply
* Re: [PATCH 2/2] virtio-net: fix buggy features advertised by host
From: Cornelia Huck @ 2014-11-13 8:53 UTC (permalink / raw)
To: Jason Wang; +Cc: netdev, virtualization, linux-kernel, mst
In-Reply-To: <1415857974-23326-2-git-send-email-jasowang@redhat.com>
On Thu, 13 Nov 2014 13:52:54 +0800
Jason Wang <jasowang@redhat.com> wrote:
> This patch tries to detect the possible buggy features advertised by host
> and fix them. One example is booting virtio-net with only ctrl_vq disabled,
> qemu may still advertise many features which depends on it. This will
> trigger several BUG()s in virtnet_send_command().
>
> This patch utilizes the fix_features() method, and disables all features that
> depends on ctrl_vq if it was not advertised.
>
> This fixes the crash when booting with ctrl_vq=off.
That's a qemu device property, right? Might want to mention that, as
this line sounds like it is a kernel parameter.
>
> Cc: Rusty Russell <rusty@rustcorp.com.au>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
> ---
> Changes from V1:
> - fix the cut-and-paste error
> ---
> drivers/net/virtio_net.c | 35 +++++++++++++++++++++++++++++++++++
> 1 file changed, 35 insertions(+)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index ec2a8b4..6ce125e 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -1948,6 +1948,40 @@ static int virtnet_restore(struct virtio_device *vdev)
> }
> #endif
>
> +static void virtnet_fix_features(struct virtio_device *dev)
> +{
> + if (!virtio_has_feature(dev, VIRTIO_NET_F_CTRL_VQ)) {
> + if (virtio_has_feature(dev, VIRTIO_NET_F_CTRL_RX)) {
> + pr_warning("Disable VIRTIO_NET_F_CTRL_RX since host "
> + "does not advertise VIRTIO_NET_F_CTRL_VQ");
> + virtio_disable_feature(dev, VIRTIO_NET_F_CTRL_RX);
> + }
You should probably use dev_warn() or so, so that the user can figure
out which device the message is for. And perhaps add "buggy hypervisor"
to the message to make clear that it's not a guest problem.
I also like the suggestion to use a dependency array.
^ permalink raw reply
* [PATCH net-next] tun: fix issues of iovec iterators using in tun_put_user()
From: Jason Wang @ 2014-11-13 8:54 UTC (permalink / raw)
To: davem, jasowang, netdev, linux-kernel; +Cc: mst, Herbert Xu
This patch fixes two issues after using iovec iterators:
- vlan_offset should be initialized to zero, otherwise unexpected offset
will be used in skb_copy_datagram_iter()
- advance iovec iterator when vnet_hdr_sz is greater than sizeof(gso), this
is the case when mergeable rx buffer were enabled for a virt guest.
Fixes e0b46d0ee9c240c7430a47e9b0365674d4a04522 ("tun: Use iovec iterators")
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Jason Wang <jasowang@redhat.com>
---
drivers/net/tun.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index 2ff769b..e3fa65a 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1235,7 +1235,7 @@ static ssize_t tun_put_user(struct tun_struct *tun,
{
struct tun_pi pi = { 0, skb->protocol };
ssize_t total;
- int vlan_offset;
+ int vlan_offset = 0;
int vlan_hlen = 0;
int vnet_hdr_sz = 0;
@@ -1304,6 +1304,8 @@ static ssize_t tun_put_user(struct tun_struct *tun,
if (copy_to_iter(&gso, sizeof(gso), iter) != sizeof(gso))
return -EFAULT;
+
+ iov_iter_advance(iter, vnet_hdr_sz - sizeof(gso));
}
if (vlan_hlen) {
--
1.9.1
^ permalink raw reply related
* Re: [PATCH net-next] tun: fix issues of iovec iterators using in tun_put_user()
From: Herbert Xu @ 2014-11-13 8:58 UTC (permalink / raw)
To: Jason Wang; +Cc: davem, netdev, linux-kernel, mst
In-Reply-To: <1415868854-4913-1-git-send-email-jasowang@redhat.com>
On Thu, Nov 13, 2014 at 04:54:14PM +0800, Jason Wang wrote:
> This patch fixes two issues after using iovec iterators:
> - vlan_offset should be initialized to zero, otherwise unexpected offset
> will be used in skb_copy_datagram_iter()
> - advance iovec iterator when vnet_hdr_sz is greater than sizeof(gso), this
> is the case when mergeable rx buffer were enabled for a virt guest.
>
> Fixes e0b46d0ee9c240c7430a47e9b0365674d4a04522 ("tun: Use iovec iterators")
> Cc: Herbert Xu <herbert@gondor.apana.org.au>
> Signed-off-by: Jason Wang <jasowang@redhat.com>
Good catch.
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Thanks!
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* [BUG] index is out of range for nfnl_group2type[]
From: Andrey Ryabinin @ 2014-11-13 9:00 UTC (permalink / raw)
To: Pablo Neira Ayuso, Patrick McHardy, Jozsef Kadlecsik,
David S. Miller
Cc: netfilter-devel, coreteam, netdev@vger.kernel.org, linux-kernel
FYI I've spotted this:
[ 180.202810] ================================================================================
[ 180.203600] UBSan: Undefined behaviour in ../net/netfilter/nfnetlink.c:467:28
[ 180.204249] index 9 is out of range for type 'int [9]'
[ 180.204697] CPU: 0 PID: 1771 Comm: trinity-main Not tainted 3.18.0-rc4-mm1+ #122
[ 180.205365] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.7.5-0-ge51488c-20140602_164612-nilsson.home.kraxel.org 04/01/2014
[ 180.206498] 0000000000000018 0000000000000000 0000000000000009 ffff88007bdf7da8
[ 180.207220] ffffffff82b0ef5f 0000000000000092 ffffffff845ae2e0 ffff88007bdf7db8
[ 180.207887] ffffffff8199e489 ffff88007bdf7e18 ffffffff8199ea22 0000003900000000
[ 180.208639] Call Trace:
[ 180.208857] dump_stack (lib/dump_stack.c:52)
[ 180.209370] ubsan_epilogue (lib/ubsan.c:174)
[ 180.209849] __ubsan_handle_out_of_bounds (lib/ubsan.c:400)
[ 180.210512] nfnetlink_bind (net/netfilter/nfnetlink.c:467)
[ 180.210986] netlink_bind (net/netlink/af_netlink.c:1483)
[ 180.211495] SYSC_bind (net/socket.c:1541)
[ 180.211940] ? security_socket_setsockopt (security/security.c:1208)
[ 180.212541] ? SyS_setsockopt (net/socket.c:1920 net/socket.c:1900)
[ 180.213057] ? SyS_write (fs/read_write.c:276 fs/read_write.c:588 fs/read_write.c:577)
[ 180.213506] SyS_bind (net/socket.c:1527)
[ 180.213919] system_call_fastpath (arch/x86/kernel/entry_64.S:423)
[ 180.214479] ================================================================================
^ permalink raw reply
* [PATCH 0/2] xfrm: Do not hash socket policies
From: Herbert Xu @ 2014-11-13 9:00 UTC (permalink / raw)
To: Steffen Klassert; +Cc: David S. Miller, netdev
Hi Steffen:
I'm working on converting the xfrm policy hashing over to RCU
due to performance complaints. While doing this I noticed that
we're needlessly hashing socket policies.
Here are two patches to get rid of that and slightly clean things
up.
Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* [PATCH 1/2] xfrm: Do not hash socket policies
From: Herbert Xu @ 2014-11-13 9:01 UTC (permalink / raw)
To: Steffen Klassert, David S. Miller, netdev
In-Reply-To: <20141113090048.GA3120@gondor.apana.org.au>
Back in 2003 when I added policy expiration, I half-heartedly
did a clean-up and renamed xfrm_sk_policy_link/xfrm_sk_policy_unlink
to __xfrm_policy_link/__xfrm_policy_unlink, because the latter
could be reused for all policies. I never actually got around
to using __xfrm_policy_link for non-socket policies.
Later on hashing was added to all xfrm policies, including socket
policies. In fact, we don't need hashing on socket policies at
all since they're always looked up via a linked list.
This patch restores xfrm_sk_policy_link/xfrm_sk_policy_unlink
as wrappers around __xfrm_policy_link/__xfrm_policy_unlink so
that it's obvious we're dealing with socket policies.
This patch also removes hashing from __xfrm_policy_link as for
now it's only used by socket policies which do not need to be
hashed. Ironically this will in fact allow us to use this helper
for non-socket policies which I shall do later.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
include/net/netns/xfrm.h | 4 ++--
net/xfrm/xfrm_policy.c | 35 +++++++++++++++++++++--------------
2 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h
index 9da7982..730d82a 100644
--- a/include/net/netns/xfrm.h
+++ b/include/net/netns/xfrm.h
@@ -50,8 +50,8 @@ struct netns_xfrm {
struct list_head policy_all;
struct hlist_head *policy_byidx;
unsigned int policy_idx_hmask;
- struct hlist_head policy_inexact[XFRM_POLICY_MAX * 2];
- struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX * 2];
+ struct hlist_head policy_inexact[XFRM_POLICY_MAX];
+ struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX];
unsigned int policy_count[XFRM_POLICY_MAX * 2];
struct work_struct policy_hash_work;
struct xfrm_policy_hthresh policy_hthresh;
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 88bf289..2c4daf2 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -1247,17 +1247,10 @@ out:
static void __xfrm_policy_link(struct xfrm_policy *pol, int dir)
{
struct net *net = xp_net(pol);
- struct hlist_head *chain = policy_hash_bysel(net, &pol->selector,
- pol->family, dir);
list_add(&pol->walk.all, &net->xfrm.policy_all);
- hlist_add_head(&pol->bydst, chain);
- hlist_add_head(&pol->byidx, net->xfrm.policy_byidx+idx_hash(net, pol->index));
net->xfrm.policy_count[dir]++;
xfrm_pol_hold(pol);
-
- if (xfrm_bydst_should_resize(net, dir, NULL))
- schedule_work(&net->xfrm.policy_hash_work);
}
static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol,
@@ -1265,17 +1258,31 @@ static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol,
{
struct net *net = xp_net(pol);
- if (hlist_unhashed(&pol->bydst))
+ if (list_empty(&pol->walk.all))
return NULL;
- hlist_del_init(&pol->bydst);
- hlist_del(&pol->byidx);
- list_del(&pol->walk.all);
+ /* Socket policies are not hashed. */
+ if (!hlist_unhashed(&pol->bydst)) {
+ hlist_del(&pol->bydst);
+ hlist_del(&pol->byidx);
+ }
+
+ list_del_init(&pol->walk.all);
net->xfrm.policy_count[dir]--;
return pol;
}
+static void xfrm_sk_policy_link(struct xfrm_policy *pol, int dir)
+{
+ __xfrm_policy_link(pol, XFRM_POLICY_MAX + dir);
+}
+
+static void xfrm_sk_policy_unlink(struct xfrm_policy *pol, int dir)
+{
+ __xfrm_policy_unlink(pol, XFRM_POLICY_MAX + dir);
+}
+
int xfrm_policy_delete(struct xfrm_policy *pol, int dir)
{
struct net *net = xp_net(pol);
@@ -1307,7 +1314,7 @@ int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol)
if (pol) {
pol->curlft.add_time = get_seconds();
pol->index = xfrm_gen_index(net, XFRM_POLICY_MAX+dir, 0);
- __xfrm_policy_link(pol, XFRM_POLICY_MAX+dir);
+ xfrm_sk_policy_link(pol, dir);
}
if (old_pol) {
if (pol)
@@ -1316,7 +1323,7 @@ int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol)
/* Unlinking succeeds always. This is the only function
* allowed to delete or replace socket policy.
*/
- __xfrm_policy_unlink(old_pol, XFRM_POLICY_MAX+dir);
+ xfrm_sk_policy_unlink(old_pol, dir);
}
write_unlock_bh(&net->xfrm.xfrm_policy_lock);
@@ -1349,7 +1356,7 @@ static struct xfrm_policy *clone_policy(const struct xfrm_policy *old, int dir)
memcpy(newp->xfrm_vec, old->xfrm_vec,
newp->xfrm_nr*sizeof(struct xfrm_tmpl));
write_lock_bh(&net->xfrm.xfrm_policy_lock);
- __xfrm_policy_link(newp, XFRM_POLICY_MAX+dir);
+ xfrm_sk_policy_link(newp, dir);
write_unlock_bh(&net->xfrm.xfrm_policy_lock);
xfrm_pol_put(newp);
}
^ permalink raw reply related
* [PATCH 2/2] xfrm: Use __xfrm_policy_link in xfrm_policy_insert
From: Herbert Xu @ 2014-11-13 9:01 UTC (permalink / raw)
To: Steffen Klassert, David S. Miller, netdev
In-Reply-To: <20141113090048.GA3120@gondor.apana.org.au>
For a long time we couldn't actually use __xfrm_policy_link in
xfrm_policy_insert because the latter wanted to do hashing at
a specific position.
Now that __xfrm_policy_link no longer does hashing it can now
be safely used in xfrm_policy_insert to kill some duplicate code,
finally reuniting general policies with socket policies.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
net/xfrm/xfrm_policy.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 2c4daf2..0a69c87 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -55,6 +55,7 @@ static int stale_bundle(struct dst_entry *dst);
static int xfrm_bundle_ok(struct xfrm_dst *xdst);
static void xfrm_policy_queue_process(unsigned long arg);
+static void __xfrm_policy_link(struct xfrm_policy *pol, int dir);
static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol,
int dir);
@@ -779,8 +780,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
hlist_add_behind(&policy->bydst, newpos);
else
hlist_add_head(&policy->bydst, chain);
- xfrm_pol_hold(policy);
- net->xfrm.policy_count[dir]++;
+ __xfrm_policy_link(policy, dir);
atomic_inc(&net->xfrm.flow_cache_genid);
/* After previous checking, family can either be AF_INET or AF_INET6 */
@@ -799,7 +799,6 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
policy->curlft.use_time = 0;
if (!mod_timer(&policy->timer, jiffies + HZ))
xfrm_pol_hold(policy);
- list_add(&policy->walk.all, &net->xfrm.policy_all);
write_unlock_bh(&net->xfrm.xfrm_policy_lock);
if (delpol)
^ permalink raw reply related
* Re: [PATCH 0/3] sh_eth: Remove redundant alignment adjustment
From: Geert Uytterhoeven @ 2014-11-13 9:04 UTC (permalink / raw)
To: Yoshihiro Kaneko
Cc: netdev@vger.kernel.org, David S. Miller, Simon Horman,
Magnus Damm, Linux-sh list
In-Reply-To: <1415862301-28032-1-git-send-email-ykaneko0929@gmail.com>
Hi Kaneko-san,
On Thu, Nov 13, 2014 at 8:04 AM, Yoshihiro Kaneko <ykaneko0929@gmail.com> wrote:
> This series is based on net tree.
>
> Mitsuhiro Kimura (3):
> sh_eth: Remove redundant alignment adjustment
> sh_eth: Fix skb alloc size and alignment adjust rule.
> sh_eth: Fix dma mapping issue
Thanks!
I've applied this series, and your series "[PATCH 0/2] Fix sleeping function
called from invalid context", and the warnings from dma-debug.c I was
seeing on r8a7791/koelsch are gone.
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply
* Re: [PATCH 0/2] xfrm: Do not hash socket policies
From: Herbert Xu @ 2014-11-13 9:08 UTC (permalink / raw)
To: Steffen Klassert; +Cc: David S. Miller, netdev
In-Reply-To: <20141113090048.GA3120@gondor.apana.org.au>
On Thu, Nov 13, 2014 at 05:00:48PM +0800, Herbert Xu wrote:
> Hi Steffen:
>
> I'm working on converting the xfrm policy hashing over to RCU
> due to performance complaints. While doing this I noticed that
> we're needlessly hashing socket policies.
>
> Here are two patches to get rid of that and slightly clean things
> up.
Oops that didn't work very well as I left out some rather important
bits :)
Here is a second revision.
Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* [PATCH 1/2] xfrm: Do not hash socket policies
From: Herbert Xu @ 2014-11-13 9:09 UTC (permalink / raw)
To: Steffen Klassert, David S. Miller, netdev
In-Reply-To: <20141113090811.GA3280@gondor.apana.org.au>
Back in 2003 when I added policy expiration, I half-heartedly
did a clean-up and renamed xfrm_sk_policy_link/xfrm_sk_policy_unlink
to __xfrm_policy_link/__xfrm_policy_unlink, because the latter
could be reused for all policies. I never actually got around
to using __xfrm_policy_link for non-socket policies.
Later on hashing was added to all xfrm policies, including socket
policies. In fact, we don't need hashing on socket policies at
all since they're always looked up via a linked list.
This patch restores xfrm_sk_policy_link/xfrm_sk_policy_unlink
as wrappers around __xfrm_policy_link/__xfrm_policy_unlink so
that it's obvious we're dealing with socket policies.
This patch also removes hashing from __xfrm_policy_link as for
now it's only used by socket policies which do not need to be
hashed. Ironically this will in fact allow us to use this helper
for non-socket policies which I shall do later.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
include/net/netns/xfrm.h | 4 ++--
net/xfrm/xfrm_policy.c | 44 ++++++++++++++++++++++++++------------------
2 files changed, 28 insertions(+), 20 deletions(-)
diff --git a/include/net/netns/xfrm.h b/include/net/netns/xfrm.h
index 9da7982..730d82a 100644
--- a/include/net/netns/xfrm.h
+++ b/include/net/netns/xfrm.h
@@ -50,8 +50,8 @@ struct netns_xfrm {
struct list_head policy_all;
struct hlist_head *policy_byidx;
unsigned int policy_idx_hmask;
- struct hlist_head policy_inexact[XFRM_POLICY_MAX * 2];
- struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX * 2];
+ struct hlist_head policy_inexact[XFRM_POLICY_MAX];
+ struct xfrm_policy_hash policy_bydst[XFRM_POLICY_MAX];
unsigned int policy_count[XFRM_POLICY_MAX * 2];
struct work_struct policy_hash_work;
struct xfrm_policy_hthresh policy_hthresh;
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 88bf289..3e015ac 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -561,7 +561,7 @@ static void xfrm_hash_resize(struct work_struct *work)
mutex_lock(&hash_resize_mutex);
total = 0;
- for (dir = 0; dir < XFRM_POLICY_MAX * 2; dir++) {
+ for (dir = 0; dir < XFRM_POLICY_MAX; dir++) {
if (xfrm_bydst_should_resize(net, dir, &total))
xfrm_bydst_resize(net, dir);
}
@@ -601,7 +601,7 @@ static void xfrm_hash_rebuild(struct work_struct *work)
write_lock_bh(&net->xfrm.xfrm_policy_lock);
/* reset the bydst and inexact table in all directions */
- for (dir = 0; dir < XFRM_POLICY_MAX * 2; dir++) {
+ for (dir = 0; dir < XFRM_POLICY_MAX; dir++) {
INIT_HLIST_HEAD(&net->xfrm.policy_inexact[dir]);
hmask = net->xfrm.policy_bydst[dir].hmask;
odst = net->xfrm.policy_bydst[dir].table;
@@ -1247,17 +1247,10 @@ out:
static void __xfrm_policy_link(struct xfrm_policy *pol, int dir)
{
struct net *net = xp_net(pol);
- struct hlist_head *chain = policy_hash_bysel(net, &pol->selector,
- pol->family, dir);
list_add(&pol->walk.all, &net->xfrm.policy_all);
- hlist_add_head(&pol->bydst, chain);
- hlist_add_head(&pol->byidx, net->xfrm.policy_byidx+idx_hash(net, pol->index));
net->xfrm.policy_count[dir]++;
xfrm_pol_hold(pol);
-
- if (xfrm_bydst_should_resize(net, dir, NULL))
- schedule_work(&net->xfrm.policy_hash_work);
}
static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol,
@@ -1265,17 +1258,31 @@ static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol,
{
struct net *net = xp_net(pol);
- if (hlist_unhashed(&pol->bydst))
+ if (list_empty(&pol->walk.all))
return NULL;
- hlist_del_init(&pol->bydst);
- hlist_del(&pol->byidx);
- list_del(&pol->walk.all);
+ /* Socket policies are not hashed. */
+ if (!hlist_unhashed(&pol->bydst)) {
+ hlist_del(&pol->bydst);
+ hlist_del(&pol->byidx);
+ }
+
+ list_del_init(&pol->walk.all);
net->xfrm.policy_count[dir]--;
return pol;
}
+static void xfrm_sk_policy_link(struct xfrm_policy *pol, int dir)
+{
+ __xfrm_policy_link(pol, XFRM_POLICY_MAX + dir);
+}
+
+static void xfrm_sk_policy_unlink(struct xfrm_policy *pol, int dir)
+{
+ __xfrm_policy_unlink(pol, XFRM_POLICY_MAX + dir);
+}
+
int xfrm_policy_delete(struct xfrm_policy *pol, int dir)
{
struct net *net = xp_net(pol);
@@ -1307,7 +1314,7 @@ int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol)
if (pol) {
pol->curlft.add_time = get_seconds();
pol->index = xfrm_gen_index(net, XFRM_POLICY_MAX+dir, 0);
- __xfrm_policy_link(pol, XFRM_POLICY_MAX+dir);
+ xfrm_sk_policy_link(pol, dir);
}
if (old_pol) {
if (pol)
@@ -1316,7 +1323,7 @@ int xfrm_sk_policy_insert(struct sock *sk, int dir, struct xfrm_policy *pol)
/* Unlinking succeeds always. This is the only function
* allowed to delete or replace socket policy.
*/
- __xfrm_policy_unlink(old_pol, XFRM_POLICY_MAX+dir);
+ xfrm_sk_policy_unlink(old_pol, dir);
}
write_unlock_bh(&net->xfrm.xfrm_policy_lock);
@@ -1349,7 +1356,7 @@ static struct xfrm_policy *clone_policy(const struct xfrm_policy *old, int dir)
memcpy(newp->xfrm_vec, old->xfrm_vec,
newp->xfrm_nr*sizeof(struct xfrm_tmpl));
write_lock_bh(&net->xfrm.xfrm_policy_lock);
- __xfrm_policy_link(newp, XFRM_POLICY_MAX+dir);
+ xfrm_sk_policy_link(newp, dir);
write_unlock_bh(&net->xfrm.xfrm_policy_lock);
xfrm_pol_put(newp);
}
@@ -2966,10 +2973,11 @@ static int __net_init xfrm_policy_init(struct net *net)
goto out_byidx;
net->xfrm.policy_idx_hmask = hmask;
- for (dir = 0; dir < XFRM_POLICY_MAX * 2; dir++) {
+ for (dir = 0; dir < XFRM_POLICY_MAX; dir++) {
struct xfrm_policy_hash *htab;
net->xfrm.policy_count[dir] = 0;
+ net->xfrm.policy_count[XFRM_POLICY_MAX + dir] = 0;
INIT_HLIST_HEAD(&net->xfrm.policy_inexact[dir]);
htab = &net->xfrm.policy_bydst[dir];
@@ -3021,7 +3029,7 @@ static void xfrm_policy_fini(struct net *net)
WARN_ON(!list_empty(&net->xfrm.policy_all));
- for (dir = 0; dir < XFRM_POLICY_MAX * 2; dir++) {
+ for (dir = 0; dir < XFRM_POLICY_MAX; dir++) {
struct xfrm_policy_hash *htab;
WARN_ON(!hlist_empty(&net->xfrm.policy_inexact[dir]));
^ permalink raw reply related
* [PATCH 2/2] xfrm: Use __xfrm_policy_link in xfrm_policy_insert
From: Herbert Xu @ 2014-11-13 9:09 UTC (permalink / raw)
To: Steffen Klassert, David S. Miller, netdev
In-Reply-To: <20141113090811.GA3280@gondor.apana.org.au>
For a long time we couldn't actually use __xfrm_policy_link in
xfrm_policy_insert because the latter wanted to do hashing at
a specific position.
Now that __xfrm_policy_link no longer does hashing it can now
be safely used in xfrm_policy_insert to kill some duplicate code,
finally reuniting general policies with socket policies.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
net/xfrm/xfrm_policy.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 3e015ac..2205278 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -55,6 +55,7 @@ static int stale_bundle(struct dst_entry *dst);
static int xfrm_bundle_ok(struct xfrm_dst *xdst);
static void xfrm_policy_queue_process(unsigned long arg);
+static void __xfrm_policy_link(struct xfrm_policy *pol, int dir);
static struct xfrm_policy *__xfrm_policy_unlink(struct xfrm_policy *pol,
int dir);
@@ -779,8 +780,7 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
hlist_add_behind(&policy->bydst, newpos);
else
hlist_add_head(&policy->bydst, chain);
- xfrm_pol_hold(policy);
- net->xfrm.policy_count[dir]++;
+ __xfrm_policy_link(policy, dir);
atomic_inc(&net->xfrm.flow_cache_genid);
/* After previous checking, family can either be AF_INET or AF_INET6 */
@@ -799,7 +799,6 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl)
policy->curlft.use_time = 0;
if (!mod_timer(&policy->timer, jiffies + HZ))
xfrm_pol_hold(policy);
- list_add(&policy->walk.all, &net->xfrm.policy_all);
write_unlock_bh(&net->xfrm.xfrm_policy_lock);
if (delpol)
^ permalink raw reply related
* Re: [PATCH 1/2] virito: introduce methods of fixing device features
From: Jason Wang @ 2014-11-13 9:11 UTC (permalink / raw)
To: Cornelia Huck; +Cc: netdev, virtualization, linux-kernel, mst
In-Reply-To: <20141113094604.1f248c3d.cornelia.huck@de.ibm.com>
On 11/13/2014 04:46 PM, Cornelia Huck wrote:
> On Thu, 13 Nov 2014 13:52:53 +0800
> Jason Wang <jasowang@redhat.com> wrote:
>
> typo in subject-prefix: s/virito/virtio/
>
Will correct this.
>> Buggy host may advertised buggy host features (a usual case is that host
>> advertise a feature whose dependencies were missed). In this case, driver
>> should detect and disable the buggy features by itself.
>>
>> This patch introduces driver specific fix_features() method which is called
>> just before features finalizing to detect and disable buggy features
>> advertised by host.
> So the basic problem this patch fixes is that an individual driver may
> only specify a static set of features but cannot specify any
> dependencies, right?
Right, and what even worse is qemu could not handle dependencies as
well. So we need fix both sides.
> Adding a sanitizer step makes sense, I guess.
>
>> Virtio-net will be the first user.
>>
>> Cc: Rusty Russell <rusty@rustcorp.com.au>
>> Cc: Michael S. Tsirkin <mst@redhat.com>
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>> ---
>> drivers/virtio/virtio.c | 4 ++++
>> include/linux/virtio.h | 1 +
>> include/linux/virtio_config.h | 12 ++++++++++++
>> 3 files changed, 17 insertions(+)
>>
>> diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
>> index df598dd..7001d6e 100644
>> --- a/drivers/virtio/virtio.c
>> +++ b/drivers/virtio/virtio.c
>> @@ -181,6 +181,10 @@ static int virtio_dev_probe(struct device *_d)
>> if (device_features & (1 << i))
>> set_bit(i, dev->features);
>>
>> + /* Fix buggy features advertised by host */
>> + if (drv->fix_features)
>> + drv->fix_features(dev);
> I'd probably call this "sanitize_features" instead.
Ok.
>> +
>> dev->config->finalize_features(dev);
>>
>> err = drv->probe(dev);
>> diff --git a/include/linux/virtio_config.h b/include/linux/virtio_config.h
>> index 7f4ef66..7bd89ea 100644
>> --- a/include/linux/virtio_config.h
>> +++ b/include/linux/virtio_config.h
>> @@ -96,6 +96,18 @@ static inline bool virtio_has_feature(const struct virtio_device *vdev,
>> return test_bit(fbit, vdev->features);
>> }
>>
>> +static inline void virtio_disable_feature(struct virtio_device *vdev,
>> + unsigned int fbit)
>> +{
>> + BUG_ON(fbit >= VIRTIO_TRANSPORT_F_START);
>> + BUG_ON(vdev->config->get_status(vdev) &
>> + ~(VIRTIO_CONFIG_S_ACKNOWLEDGE | VIRTIO_CONFIG_S_DRIVER));
> When we add virtio-1 support, we can add a check for FEATURES_OK here,
> so we're really on the safe side.
>
If I read the spec correctly, FEATURES_OK was set only after writing the
features bits to device. But we want to sanitize the them before.
>> +
>> + virtio_check_driver_offered_feature(vdev, fbit);
>> +
>> + clear_bit(fbit, vdev->features);
>> +}
>> +
>> static inline
>> struct virtqueue *virtio_find_single_vq(struct virtio_device *vdev,
>> vq_callback_t *c, const char *n)
> The approach looks good to me.
>
Thanks for the review.
^ permalink raw reply
* Re: [PATCH 2/2] virtio-net: fix buggy features advertised by host
From: Jason Wang @ 2014-11-13 9:12 UTC (permalink / raw)
To: Cornelia Huck; +Cc: netdev, virtualization, linux-kernel, mst
In-Reply-To: <20141113095326.3e296c77.cornelia.huck@de.ibm.com>
On 11/13/2014 04:53 PM, Cornelia Huck wrote:
> On Thu, 13 Nov 2014 13:52:54 +0800
> Jason Wang <jasowang@redhat.com> wrote:
>
>> This patch tries to detect the possible buggy features advertised by host
>> and fix them. One example is booting virtio-net with only ctrl_vq disabled,
>> qemu may still advertise many features which depends on it. This will
>> trigger several BUG()s in virtnet_send_command().
>>
>> This patch utilizes the fix_features() method, and disables all features that
>> depends on ctrl_vq if it was not advertised.
>>
>> This fixes the crash when booting with ctrl_vq=off.
> That's a qemu device property, right? Might want to mention that, as
> this line sounds like it is a kernel parameter.
Right, ok.
>> Cc: Rusty Russell <rusty@rustcorp.com.au>
>> Cc: Michael S. Tsirkin <mst@redhat.com>
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>> ---
>> Changes from V1:
>> - fix the cut-and-paste error
>> ---
>> drivers/net/virtio_net.c | 35 +++++++++++++++++++++++++++++++++++
>> 1 file changed, 35 insertions(+)
>>
>> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
>> index ec2a8b4..6ce125e 100644
>> --- a/drivers/net/virtio_net.c
>> +++ b/drivers/net/virtio_net.c
>> @@ -1948,6 +1948,40 @@ static int virtnet_restore(struct virtio_device *vdev)
>> }
>> #endif
>>
>> +static void virtnet_fix_features(struct virtio_device *dev)
>> +{
>> + if (!virtio_has_feature(dev, VIRTIO_NET_F_CTRL_VQ)) {
>> + if (virtio_has_feature(dev, VIRTIO_NET_F_CTRL_RX)) {
>> + pr_warning("Disable VIRTIO_NET_F_CTRL_RX since host "
>> + "does not advertise VIRTIO_NET_F_CTRL_VQ");
>> + virtio_disable_feature(dev, VIRTIO_NET_F_CTRL_RX);
>> + }
> You should probably use dev_warn() or so, so that the user can figure
> out which device the message is for. And perhaps add "buggy hypervisor"
> to the message to make clear that it's not a guest problem.
Ok.
> I also like the suggestion to use a dependency array.
>
Yes, will do it in next version.
^ permalink raw reply
* Re: [PATCH 1/2] virito: introduce methods of fixing device features
From: Cornelia Huck @ 2014-11-13 9:14 UTC (permalink / raw)
To: Jason Wang; +Cc: netdev, virtualization, linux-kernel, mst
In-Reply-To: <546475C2.50606@redhat.com>
On Thu, 13 Nov 2014 17:11:30 +0800
Jason Wang <jasowang@redhat.com> wrote:
> On 11/13/2014 04:46 PM, Cornelia Huck wrote:
> > On Thu, 13 Nov 2014 13:52:53 +0800
> > Jason Wang <jasowang@redhat.com> wrote:
> >> +static inline void virtio_disable_feature(struct virtio_device *vdev,
> >> + unsigned int fbit)
> >> +{
> >> + BUG_ON(fbit >= VIRTIO_TRANSPORT_F_START);
> >> + BUG_ON(vdev->config->get_status(vdev) &
> >> + ~(VIRTIO_CONFIG_S_ACKNOWLEDGE | VIRTIO_CONFIG_S_DRIVER));
> > When we add virtio-1 support, we can add a check for FEATURES_OK here,
> > so we're really on the safe side.
> >
>
> If I read the spec correctly, FEATURES_OK was set only after writing the
> features bits to device. But we want to sanitize the them before.
I meant doing a BUG when FEATURES_OK is set - sorry for not being clear.
^ permalink raw reply
* Re: [PATCH 1/2] virito: introduce methods of fixing device features
From: Jason Wang @ 2014-11-13 9:49 UTC (permalink / raw)
To: Cornelia Huck; +Cc: netdev, virtualization, linux-kernel, mst
In-Reply-To: <20141113101456.43acfdb7.cornelia.huck@de.ibm.com>
On 11/13/2014 05:14 PM, Cornelia Huck wrote:
> On Thu, 13 Nov 2014 17:11:30 +0800
> Jason Wang <jasowang@redhat.com> wrote:
>
>> On 11/13/2014 04:46 PM, Cornelia Huck wrote:
>>> On Thu, 13 Nov 2014 13:52:53 +0800
>>> Jason Wang <jasowang@redhat.com> wrote:
>>>> +static inline void virtio_disable_feature(struct virtio_device *vdev,
>>>> + unsigned int fbit)
>>>> +{
>>>> + BUG_ON(fbit >= VIRTIO_TRANSPORT_F_START);
>>>> + BUG_ON(vdev->config->get_status(vdev) &
>>>> + ~(VIRTIO_CONFIG_S_ACKNOWLEDGE | VIRTIO_CONFIG_S_DRIVER));
>>> When we add virtio-1 support, we can add a check for FEATURES_OK here,
>>> so we're really on the safe side.
>>>
>> If I read the spec correctly, FEATURES_OK was set only after writing the
>> features bits to device. But we want to sanitize the them before.
> I meant doing a BUG when FEATURES_OK is set - sorry for not being clear.
>
I get it, thanks for the clarification.
^ permalink raw reply
* Resume S4 - r8169 BROKEN
From: poma @ 2014-11-13 9:50 UTC (permalink / raw)
To: netdev
Resume S4 - r8169 RealTek RTL-8169 Gigabit Ethernet driver - BROKEN
Tested with:
kernel-3.18.0-0.rc4.git0.2.fc22
http://koji.fedoraproject.org/koji/buildinfo?buildID=592269
Nov 11 2014
&
kernel-3.18.0-rc2.git-9dfa9a2-net-next+
https://git.kernel.org/cgit/linux/kernel/git/davem/net-next.git/commit/?id=9dfa9a2
2014-11-13
# lspci -knn -s 03:00.0
03:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller [10ec:8168] (rev 02)
Subsystem: Gigabyte Technology Co., Ltd Motherboard [1458:e000]
Kernel driver in use: r8169
Kernel modules: r8169
# modprobe -v r8169
insmod /lib/modules/3.18.0-rc2.git-9dfa9a2-net-next+/kernel/drivers/net/mii.ko
insmod /lib/modules/3.18.0-rc2.git-9dfa9a2-net-next+/kernel/drivers/net/ethernet/realtek/r8169.ko
# dmesg
[ 142.344223] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
[ 142.344229] r8169 0000:03:00.0: can't disable ASPM; OS doesn't have ASPM control
[ 142.344456] r8169 0000:03:00.0: irq 26 for MSI/MSI-X
[ 142.344600] r8169 0000:03:00.0 eth1: RTL8168c/8111c at 0xffffc9000291a000, 00:12:34:56:78:30, XID 1c4000c0 IRQ 26
[ 142.344602] r8169 0000:03:00.0 eth1: jumbo features [frames: 6128 bytes, tx checksumming: ko]
[ 142.388933] r8169 0000:03:00.0 enp3s0: renamed from eth1
[ 142.417502] r8169 0000:03:00.0 enp3s0: link down
[ 142.417512] r8169 0000:03:00.0 enp3s0: link down
[ 144.029918] r8169 0000:03:00.0 enp3s0: link up
# ifconfig enp3s0
enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.2.2 netmask 255.255.255.0 broadcast 192.168.2.255
inet6 fe80::212:34ff:fe56:7830 prefixlen 64 scopeid 0x20<link>
ether 00:12:34:56:78:30 txqueuelen 1000 (Ethernet)
RX packets 642 bytes 382970 (373.9 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 709 bytes 72634 (70.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
# ping kernel.org -c10
PING kernel.org (199.204.44.194) 56(84) bytes of data.
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=1 ttl=49 time=134 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=2 ttl=49 time=133 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=3 ttl=49 time=134 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=4 ttl=49 time=133 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=5 ttl=49 time=134 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=6 ttl=49 time=134 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=7 ttl=49 time=134 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=8 ttl=49 time=133 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=9 ttl=49 time=133 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=10 ttl=49 time=134 ms
--- kernel.org ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9011ms
rtt min/avg/max/mdev = 133.008/134.163/134.987/0.683 ms
~~~~~~~~~~~~~~~~~~~
# systemctl suspend
& RESUME
~~~~~~~~
# dmesg
[ 673.601499] PM: Syncing filesystems ... done.
[ 673.793930] PM: Preparing system for mem sleep
[ 673.961198] Freezing user space processes ... (elapsed 0.002 seconds) done.
[ 673.963420] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[ 673.964664] PM: Entering mem sleep
[ 676.457146] PM: suspend of devices complete after 2492.103 msecs
[ 676.457826] PM: late suspend of devices complete after 0.673 msecs
[ 676.469303] PM: noirq suspend of devices complete after 11.469 msecs
[ 676.469889] ACPI: Preparing to enter system sleep state S3
[ 676.470890] PM: Saving platform NVS memory
[ 676.479540] ACPI: Low-level resume complete
[ 676.479613] PM: Restoring platform NVS memory
[ 676.525167] ACPI: Waking up from system sleep state S3
[ 676.590780] r8169 0000:03:00.0 enp3s0: link down
[ 678.060741] r8169 0000:03:00.0 enp3s0: link up
[ 679.604068] PM: resume of devices complete after 3066.534 msecs
[ 679.604657] PM: Finishing wakeup.
[ 679.604662] Restarting tasks ... done.
# ifconfig enp3s0
enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.2.2 netmask 255.255.255.0 broadcast 192.168.2.255
inet6 fe80::212:34ff:fe56:7830 prefixlen 64 scopeid 0x20<link>
ether 00:12:34:56:78:30 txqueuelen 1000 (Ethernet)
RX packets 782 bytes 464566 (453.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 860 bytes 86524 (84.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
# ping kernel.org -c10
PING kernel.org (199.204.44.194) 56(84) bytes of data.
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=1 ttl=49 time=134 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=2 ttl=49 time=134 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=3 ttl=49 time=133 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=4 ttl=49 time=132 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=5 ttl=49 time=134 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=6 ttl=49 time=133 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=7 ttl=49 time=133 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=8 ttl=49 time=133 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=9 ttl=49 time=133 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=10 ttl=49 time=134 ms
--- kernel.org ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9011ms
rtt min/avg/max/mdev = 132.798/133.770/134.919/0.682 ms
~~~~~~~~~~~~~~~~~~~~~
# systemctl hibernate
& THAW
~~~~~~
# dmesg
[ 1187.902839] PM: Hibernation mode set to 'platform'
[ 1188.098296] PM: Syncing filesystems ... done.
[ 1188.545125] Freezing user space processes ... (elapsed 0.002 seconds) done.
[ 1188.548022] PM: Marking nosave pages: [mem 0x00000000-0x00000fff]
[ 1188.548031] PM: Marking nosave pages: [mem 0x0009e000-0x000fffff]
[ 1188.548042] PM: Marking nosave pages: [mem 0xcfef0000-0xffffffff]
[ 1188.549729] PM: Basic memory bitmaps created
[ 1188.549755] PM: Preallocating image memory... done (allocated 641929 pages)
[ 1189.133132] PM: Allocated 2567716 kbytes in 0.58 seconds (4427.09 MB/s)
[ 1189.133241] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[ 1191.867738] PM: freeze of devices complete after 2732.078 msecs
[ 1191.868597] PM: late freeze of devices complete after 0.855 msecs
[ 1191.869951] PM: noirq freeze of devices complete after 1.344 msecs
[ 1191.871294] ACPI: Preparing to enter system sleep state S4
[ 1191.871956] PM: Saving platform NVS memory
[ 1191.879106] PM: Creating hibernation image:
[ 1192.100544] PM: Need to copy 359761 pages
[ 1192.100558] PM: Normal pages needed: 359761 + 1024, available pages: 688358
[ 1191.880196] PM: Restoring platform NVS memory
[ 1191.925748] ACPI: Waking up from system sleep state S4
[ 1191.936325] PM: noirq restore of devices complete after 10.428 msecs
[ 1191.936796] PM: early restore of devices complete after 0.423 msecs
[ 1192.043225] r8169 0000:03:00.0 enp3s0: link down
[ 1192.689507] PM: restore of devices complete after 699.641 msecs
[ 1192.689835] PM: Image restored successfully.
[ 1192.689856] PM: Basic memory bitmaps freed
[ 1192.689860] Restarting tasks ... done.
[ 1193.672620] r8169 0000:03:00.0 enp3s0: link up
# ifconfig enp3s0
enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.2.2 netmask 255.255.255.0 broadcast 192.168.2.255
inet6 fe80::212:34ff:fe56:7830 prefixlen 64 scopeid 0x20<link>
ether 00:12:34:56:78:30 txqueuelen 1000 (Ethernet)
RX packets 794 bytes 465496 (454.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 939 bytes 90700 (88.5 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
# ping kernel.org -c10
ping: unknown host kernel.org
# ping 199.204.44.194 -c10
PING 199.204.44.194 (199.204.44.194) 56(84) bytes of data.
>From 192.168.2.2 icmp_seq=1 Destination Host Unreachable
>From 192.168.2.2 icmp_seq=2 Destination Host Unreachable
>From 192.168.2.2 icmp_seq=3 Destination Host Unreachable
>From 192.168.2.2 icmp_seq=4 Destination Host Unreachable
>From 192.168.2.2 icmp_seq=5 Destination Host Unreachable
>From 192.168.2.2 icmp_seq=6 Destination Host Unreachable
>From 192.168.2.2 icmp_seq=7 Destination Host Unreachable
>From 192.168.2.2 icmp_seq=8 Destination Host Unreachable
>From 192.168.2.2 icmp_seq=9 Destination Host Unreachable
>From 192.168.2.2 icmp_seq=10 Destination Host Unreachable
--- 199.204.44.194 ping statistics ---
10 packets transmitted, 0 received, +10 errors, 100% packet loss, time 9001ms
pipe 4
~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
# modprobe -rv r8169 && modprobe -v r8169
rmmod r8169
rmmod mii
insmod /lib/modules/3.18.0-rc2.git-9dfa9a2-net-next+/kernel/drivers/net/mii.ko
insmod /lib/modules/3.18.0-rc2.git-9dfa9a2-net-next+/kernel/drivers/net/ethernet/realtek/r8169.ko
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# dmesg
[ 1566.163904] r8169 Gigabit Ethernet driver 2.3LK-NAPI loaded
[ 1566.163932] r8169 0000:03:00.0: can't disable ASPM; OS doesn't have ASPM control
[ 1566.164443] r8169 0000:03:00.0: irq 26 for MSI/MSI-X
[ 1566.164997] r8169 0000:03:00.0 eth1: RTL8168c/8111c at 0xffffc900027d0000, 00:12:34:56:78:30, XID 1c4000c0 IRQ 26
[ 1566.165007] r8169 0000:03:00.0 eth1: jumbo features [frames: 6128 bytes, tx checksumming: ko]
[ 1566.383002] r8169 0000:03:00.0 enp3s0: renamed from eth1
[ 1566.401190] r8169 0000:03:00.0 enp3s0: link down
[ 1567.909282] r8169 0000:03:00.0 enp3s0: link up
# ifconfig enp3s0
enp3s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.2.2 netmask 255.255.255.0 broadcast 192.168.2.255
inet6 fe80::212:34ff:fe56:7830 prefixlen 64 scopeid 0x20<link>
ether 00:12:34:56:78:30 txqueuelen 1000 (Ethernet)
RX packets 59 bytes 14200 (13.8 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 77 bytes 7441 (7.2 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
# ping kernel.org -c10
PING kernel.org (199.204.44.194) 56(84) bytes of data.
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=1 ttl=49 time=133 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=2 ttl=49 time=134 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=3 ttl=49 time=134 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=4 ttl=49 time=133 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=5 ttl=49 time=133 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=6 ttl=49 time=132 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=7 ttl=49 time=134 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=8 ttl=49 time=134 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=9 ttl=49 time=133 ms
64 bytes from yul-korg-pub.kernel.org (199.204.44.194): icmp_seq=10 ttl=49 time=133 ms
--- kernel.org ping statistics ---
10 packets transmitted, 10 received, 0% packet loss, time 9012ms
rtt min/avg/max/mdev = 132.657/133.636/134.708/0.728 ms
poma
^ permalink raw reply
* Re: [PATCH V4 1/3] can: add can_is_canfd_skb() API
From: Marc Kleine-Budde @ 2014-11-13 10:04 UTC (permalink / raw)
To: Dong Aisheng, linux-can
Cc: wg, varkabhadram, netdev, socketcan, linux-arm-kernel
In-Reply-To: <1415349914-9145-1-git-send-email-b29396@freescale.com>
[-- Attachment #1: Type: text/plain, Size: 466 bytes --]
On 11/07/2014 09:45 AM, Dong Aisheng wrote:
> The CAN device drivers can use it to check if the frame to send is on
> CAN FD mode or normal CAN mode.
Applied patches 1 and 3.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* Re: [PATCH V4 2/3] can: m_can: update to support CAN FD features
From: Marc Kleine-Budde @ 2014-11-13 10:10 UTC (permalink / raw)
To: Dong Aisheng, linux-can
Cc: wg, varkabhadram, netdev, socketcan, linux-arm-kernel
In-Reply-To: <1415349914-9145-2-git-send-email-b29396@freescale.com>
[-- Attachment #1: Type: text/plain, Size: 3112 bytes --]
On 11/07/2014 09:45 AM, Dong Aisheng wrote:
> Bosch M_CAN is CAN FD capable device. This patch implements the CAN
> FD features include up to 64 bytes payload and bitrate switch function.
> 1) Change the Rx FIFO and Tx Buffer to 64 bytes for support CAN FD
> up to 64 bytes payload. It's backward compatible with old 8 bytes
> normal CAN frame.
> 2) Allocate can frame or canfd frame based on EDL bit
> 3) Bitrate Switch function is disabled by default and will be enabled
> according to CANFD_BRS bit in cf->flags.
>
> Acked-by: Oliver Hartkopp <socketcan@hartkopp.net>
> Signed-off-by: Dong Aisheng <b29396@freescale.com>
[...]
> -static void m_can_read_fifo(const struct net_device *dev, struct can_frame *cf,
> - u32 rxfs)
> +static void m_can_read_fifo(struct net_device *dev, u32 rxfs)
> {
> + struct net_device_stats *stats = &dev->stats;
> struct m_can_priv *priv = netdev_priv(dev);
> - u32 id, fgi;
> + struct canfd_frame *cf;
> + struct sk_buff *skb;
> + u32 id, fgi, dlc;
> + int i;
>
> /* calculate the fifo get index for where to read data */
> fgi = (rxfs & RXFS_FGI_MASK) >> RXFS_FGI_OFF;
> + dlc = m_can_fifo_read(priv, fgi, M_CAN_FIFO_DLC);
> + if (dlc & RX_BUF_EDL)
> + skb = alloc_canfd_skb(dev, &cf);
> + else
> + skb = alloc_can_skb(dev, (struct can_frame **)&cf);
> + if (!skb) {
> + stats->rx_dropped++;
> + return;
> + }
> +
> id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_ID);
> if (id & RX_BUF_XTD)
> cf->can_id = (id & CAN_EFF_MASK) | CAN_EFF_FLAG;
> else
> cf->can_id = (id >> 18) & CAN_SFF_MASK;
>
> - if (id & RX_BUF_RTR) {
> + if (id & RX_BUF_ESI) {
> + cf->flags |= CANFD_ESI;
> + netdev_dbg(dev, "ESI Error\n");
> + }
> +
> + if (!(dlc & RX_BUF_EDL) && (id & RX_BUF_RTR)) {
> cf->can_id |= CAN_RTR_FLAG;
I just noticed, that you don't set the cf->dlc (or cf->len) in the RTR
case. Please create a separate patch that fixes this problem.
> } else {
> id = m_can_fifo_read(priv, fgi, M_CAN_FIFO_DLC);
> - cf->can_dlc = get_can_dlc((id >> 16) & 0x0F);
> - *(u32 *)(cf->data + 0) = m_can_fifo_read(priv, fgi,
> - M_CAN_FIFO_DATA(0));
> - *(u32 *)(cf->data + 4) = m_can_fifo_read(priv, fgi,
> - M_CAN_FIFO_DATA(1));
> + if (dlc & RX_BUF_EDL)
> + cf->len = can_dlc2len((id >> 16) & 0x0F);
> + else
> + cf->len = get_can_dlc((id >> 16) & 0x0F);
> +
> + if (id & RX_BUF_BRS)
> + cf->flags |= CANFD_BRS;
> +
> + for (i = 0; i < cf->len; i += 4)
> + *(u32 *)(cf->data + i) =
> + m_can_fifo_read(priv, fgi,
> + M_CAN_FIFO_DATA(i / 4));
> }
>
> /* acknowledge rx fifo 0 */
> m_can_write(priv, M_CAN_RXF0A, fgi);
> +
> + stats->rx_packets++;
> + stats->rx_bytes += cf->len;
> +
> + netif_receive_skb(skb);
> }
Regards,
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply
* [PATCH 0/4] rhashtable: Allow local locks to be used and tested
From: Herbert Xu @ 2014-11-13 10:10 UTC (permalink / raw)
To: netdev; +Cc: Thomas Graf
Hi:
This series moves mutex_is_held entirely under PROVE_LOCKING so
there is zero foot print when we're not debugging. More importantly
it adds a parrent argument to mutex_is_held so that we can test
local locks rather than global ones (e.g., per-namespace locks).
Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* [PATCH 1/4] netlink: Move mutex_is_held under PROVE_LOCKING
From: Herbert Xu @ 2014-11-13 10:11 UTC (permalink / raw)
To: netdev, Thomas Graf
In-Reply-To: <20141113101025.GA3728@gondor.apana.org.au>
The rhashtable function mutex_is_held is only used when PROVE_LOCKING
is enabled. This patch modifies netlink so that we can rhashtable.h
itself can later make mutex_is_held optional depending on PROVE_LOCKING.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
net/netlink/af_netlink.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 580b794..53b8ea7 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -114,14 +114,14 @@ static atomic_t nl_table_users = ATOMIC_INIT(0);
DEFINE_MUTEX(nl_sk_hash_lock);
EXPORT_SYMBOL_GPL(nl_sk_hash_lock);
+#ifdef CONFIG_PROVE_LOCKING
static int lockdep_nl_sk_hash_is_held(void)
{
-#ifdef CONFIG_LOCKDEP
if (debug_locks)
return lockdep_is_held(&nl_sk_hash_lock) || lockdep_is_held(&nl_table_lock);
-#endif
return 1;
}
+#endif
static ATOMIC_NOTIFIER_HEAD(netlink_chain);
@@ -3133,7 +3133,9 @@ static int __init netlink_proto_init(void)
.max_shift = 16, /* 64K */
.grow_decision = rht_grow_above_75,
.shrink_decision = rht_shrink_below_30,
+#ifdef CONFIG_PROVE_LOCKING
.mutex_is_held = lockdep_nl_sk_hash_is_held,
+#endif
};
if (err != 0)
^ permalink raw reply related
* [PATCH 2/4] netfilter: Move mutex_is_held under PROVE_LOCKING
From: Herbert Xu @ 2014-11-13 10:11 UTC (permalink / raw)
To: netdev, Thomas Graf
In-Reply-To: <20141113101025.GA3728@gondor.apana.org.au>
The rhashtable function mutex_is_held is only used when PROVE_LOCKING
is enabled. This patch modifies netfilter so that we can rhashtable.h
itself can later make mutex_is_held optional depending on PROVE_LOCKING.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
net/netfilter/nft_hash.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/net/netfilter/nft_hash.c b/net/netfilter/nft_hash.c
index 8892b7b..b86305c 100644
--- a/net/netfilter/nft_hash.c
+++ b/net/netfilter/nft_hash.c
@@ -153,10 +153,12 @@ static unsigned int nft_hash_privsize(const struct nlattr * const nla[])
return sizeof(struct rhashtable);
}
+#ifdef CONFIG_PROVE_LOCKING
static int lockdep_nfnl_lock_is_held(void)
{
return lockdep_nfnl_is_held(NFNL_SUBSYS_NFTABLES);
}
+#endif
static int nft_hash_init(const struct nft_set *set,
const struct nft_set_desc *desc,
@@ -171,7 +173,9 @@ static int nft_hash_init(const struct nft_set *set,
.hashfn = jhash,
.grow_decision = rht_grow_above_75,
.shrink_decision = rht_shrink_below_30,
+#ifdef CONFIG_PROVE_LOCKING
.mutex_is_held = lockdep_nfnl_lock_is_held,
+#endif
};
return rhashtable_init(priv, ¶ms);
^ permalink raw reply related
* [PATCH 3/4] rhashtable: Move mutex_is_held under PROVE_LOCKING
From: Herbert Xu @ 2014-11-13 10:11 UTC (permalink / raw)
To: netdev, Thomas Graf
In-Reply-To: <20141113101025.GA3728@gondor.apana.org.au>
The rhashtable function mutex_is_held is only used when PROVE_LOCKING
is enabled. This patch makes the mutex_is_held field in rhashtable
optional depending on PROVE_LOCKING.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---
include/linux/rhashtable.h | 2 ++
lib/rhashtable.c | 8 ++++++++
2 files changed, 10 insertions(+)
diff --git a/include/linux/rhashtable.h b/include/linux/rhashtable.h
index fb298e9d..96ce8ce 100644
--- a/include/linux/rhashtable.h
+++ b/include/linux/rhashtable.h
@@ -65,7 +65,9 @@ struct rhashtable_params {
size_t new_size);
bool (*shrink_decision)(const struct rhashtable *ht,
size_t new_size);
+#ifdef CONFIG_PROVE_LOCKING
int (*mutex_is_held)(void);
+#endif
};
/**
diff --git a/lib/rhashtable.c b/lib/rhashtable.c
index 624a0b7..548bb29 100644
--- a/lib/rhashtable.c
+++ b/lib/rhashtable.c
@@ -532,7 +532,9 @@ static size_t rounded_hashtable_size(struct rhashtable_params *params)
* .key_offset = offsetof(struct test_obj, key),
* .key_len = sizeof(int),
* .hashfn = arch_fast_hash,
+ * #ifdef CONFIG_PROVE_LOCKING
* .mutex_is_held = &my_mutex_is_held,
+ * #endif
* };
*
* Configuration Example 2: Variable length keys
@@ -552,7 +554,9 @@ static size_t rounded_hashtable_size(struct rhashtable_params *params)
* .head_offset = offsetof(struct test_obj, node),
* .hashfn = arch_fast_hash,
* .obj_hashfn = my_hash_fn,
+ * #ifdef CONFIG_PROVE_LOCKING
* .mutex_is_held = &my_mutex_is_held,
+ * #endif
* };
*/
int rhashtable_init(struct rhashtable *ht, struct rhashtable_params *params)
@@ -613,10 +617,12 @@ EXPORT_SYMBOL_GPL(rhashtable_destroy);
#define TEST_PTR ((void *) 0xdeadbeef)
#define TEST_NEXPANDS 4
+#ifdef CONFIG_PROVE_LOCKING
static int test_mutex_is_held(void)
{
return 1;
}
+#endif
struct test_obj {
void *ptr;
@@ -767,7 +773,9 @@ static int __init test_rht_init(void)
.key_offset = offsetof(struct test_obj, value),
.key_len = sizeof(int),
.hashfn = arch_fast_hash,
+#ifdef CONFIG_PROVE_LOCKING
.mutex_is_held = &test_mutex_is_held,
+#endif
.grow_decision = rht_grow_above_75,
.shrink_decision = rht_shrink_below_30,
};
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox