lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAF=yD-Kd4DkC6DWydwiwEZytE9NsnOYZg2KFFxQ8xgAA=DUiXw@mail.gmail.com>
Date:   Wed, 27 Jun 2018 06:47:18 -0400
From:   Willem de Bruijn <willemdebruijn.kernel@...il.com>
To:     Amritha Nambiar <amritha.nambiar@...el.com>
Cc:     Network Development <netdev@...r.kernel.org>,
        David Miller <davem@...emloft.net>,
        Alexander Duyck <alexander.h.duyck@...el.com>,
        "Samudrala, Sridhar" <sridhar.samudrala@...el.com>,
        Alexander Duyck <alexander.duyck@...il.com>,
        Eric Dumazet <edumazet@...gle.com>,
        Hannes Frederic Sowa <hannes@...essinduktion.org>,
        Tom Herbert <tom@...bertland.com>
Subject: Re: [net-next PATCH v4 5/7] net: Enable Tx queue selection based on
 Rx queues

> >> +static int get_xps_queue(struct net_device *dev, struct sk_buff *skb)
> >>  {
> >>  #ifdef CONFIG_XPS
> >>         struct xps_dev_maps *dev_maps;
> >> -       struct xps_map *map;
> >> +       struct sock *sk = skb->sk;
> >>         int queue_index = -1;
> >>
> >>         if (!static_key_false(&xps_needed))
> >>                 return -1;
> >>
> >>         rcu_read_lock();
> >> -       dev_maps = rcu_dereference(dev->xps_cpus_map);
> >> +       if (!static_key_false(&xps_rxqs_needed))
> >> +               goto get_cpus_map;
> >> +
> >> +       dev_maps = rcu_dereference(dev->xps_rxqs_map);
> >>         if (dev_maps) {
> >> -               unsigned int tci = skb->sender_cpu - 1;
> >> +               int tci = sk_rx_queue_get(sk);
> >
> > What if the rx device differs from the tx device?
> >
> I think I have 3 options here:
> 1. Cache the ifindex in sock_common which will introduce a new
> additional field in sock_common.
> 2. Use dev_get_by_napi_id to get the device id. This could be expensive,
> if the rxqs_map is set, this will be done on every packet and involves
> walking through the hashlist for napi_id lookup.

The tx queue mapping is cached in the sk for connected sockets, but
indeed this would be expensive for many workloads.

> 3. Remove validating device id, similar to how it is in skb_tx_hash
> where rx_queue recorded is used and if not, fall through to flow hash
> calculation.
> What do you think is suitable here?

Alternatively, just accept the misprediction in this rare case. But do
make the caveat explicit in the documentation.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ