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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 1 Feb 2023 20:46:52 +0200
From:   Vladimir Oltean <vladimir.oltean@....com>
To:     Simon Horman <simon.horman@...igine.com>
Cc:     netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
        Eric Dumazet <edumazet@...gle.com>,
        Jakub Kicinski <kuba@...nel.org>,
        Paolo Abeni <pabeni@...hat.com>,
        Claudiu Manoil <claudiu.manoil@....com>,
        Vinicius Costa Gomes <vinicius.gomes@...el.com>,
        Kurt Kanzenbach <kurt@...utronix.de>,
        Jacob Keller <jacob.e.keller@...el.com>,
        Jamal Hadi Salim <jhs@...atatu.com>,
        Cong Wang <xiyou.wangcong@...il.com>,
        Jiri Pirko <jiri@...nulli.us>
Subject: Re: [PATCH v4 net-next 04/15] net: enetc: ensure we always have a
 minimum number of TXQs for stack

Hi Simon,

On Wed, Feb 01, 2023 at 02:43:44PM +0100, Simon Horman wrote:
> The nit below notwithstanding,
> 
> Reviewed-by: Simon Horman <simon.horman@...igine.com>

I appreciate your time to review this patch set.

> > diff --git a/drivers/net/ethernet/freescale/enetc/enetc.h b/drivers/net/ethernet/freescale/enetc/enetc.h
> > index 1fe8dfd6b6d4..e21d096c5a90 100644
> > --- a/drivers/net/ethernet/freescale/enetc/enetc.h
> > +++ b/drivers/net/ethernet/freescale/enetc/enetc.h
> > @@ -369,6 +369,9 @@ struct enetc_ndev_priv {
> >  
> >  	struct psfp_cap psfp_cap;
> >  
> > +	/* Minimum number of TX queues required by the network stack */
> > +	unsigned int min_num_stack_tx_queues;
> > +
> 
> It is probably not important.
> But I do notice there are several holes in struct enetc_ndev_priv
> that would fit this field.

This is true. However, this patch was written taking pahole into
consideration, and one new field can only fill a single hole :)

Before:

pahole -C enetc_ndev_priv $KBUILD_OUTPUT/drivers/net/ethernet/freescale/enetc/enetc.o
struct enetc_ndev_priv {
        struct net_device *        ndev;                 /*     0     8 */
        struct device *            dev;                  /*     8     8 */
        struct enetc_si *          si;                   /*    16     8 */
        int                        bdr_int_num;          /*    24     4 */

        /* XXX 4 bytes hole, try to pack */

        struct enetc_int_vector *  int_vector[2];        /*    32    16 */
        u16                        num_rx_rings;         /*    48     2 */
        u16                        num_tx_rings;         /*    50     2 */
        u16                        rx_bd_count;          /*    52     2 */
        u16                        tx_bd_count;          /*    54     2 */
        u16                        msg_enable;           /*    56     2 */

        /* XXX 2 bytes hole, try to pack */

        enum enetc_active_offloads active_offloads;      /*    60     4 */
        /* --- cacheline 1 boundary (64 bytes) --- */
        u32                        speed;                /*    64     4 */

        /* XXX 4 bytes hole, try to pack */

        struct enetc_bdr * *       xdp_tx_ring;          /*    72     8 */
        struct enetc_bdr *         tx_ring[16];          /*    80   128 */
        /* --- cacheline 3 boundary (192 bytes) was 16 bytes ago --- */
        struct enetc_bdr *         rx_ring[16];          /*   208   128 */
        /* --- cacheline 5 boundary (320 bytes) was 16 bytes ago --- */
        const struct enetc_bdr_resource  * tx_res;       /*   336     8 */
        const struct enetc_bdr_resource  * rx_res;       /*   344     8 */
        struct enetc_cls_rule *    cls_rules;            /*   352     8 */
        struct psfp_cap            psfp_cap;             /*   360    20 */

        /* XXX 4 bytes hole, try to pack */

        /* --- cacheline 6 boundary (384 bytes) --- */
        struct phylink *           phylink;              /*   384     8 */
        int                        ic_mode;              /*   392     4 */
        u32                        tx_ictt;              /*   396     4 */
        struct bpf_prog *          xdp_prog;             /*   400     8 */
        long unsigned int          flags;                /*   408     8 */
        struct work_struct         tx_onestep_tstamp;    /*   416     0 */

        /* XXX 32 bytes hole, try to pack */

        /* --- cacheline 7 boundary (448 bytes) --- */
        struct sk_buff_head        tx_skbs;              /*   448     0 */

        /* size: 472, cachelines: 8, members: 26 */
        /* sum members: 402, holes: 5, sum holes: 46 */
        /* padding: 24 */
        /* last cacheline: 24 bytes */
};

After:

struct enetc_ndev_priv {
        struct net_device *        ndev;                 /*     0     8 */
        struct device *            dev;                  /*     8     8 */
        struct enetc_si *          si;                   /*    16     8 */
        int                        bdr_int_num;          /*    24     4 */

        /* XXX 4 bytes hole, try to pack */

        struct enetc_int_vector *  int_vector[2];        /*    32    16 */
        u16                        num_rx_rings;         /*    48     2 */
        u16                        num_tx_rings;         /*    50     2 */
        u16                        rx_bd_count;          /*    52     2 */
        u16                        tx_bd_count;          /*    54     2 */
        u16                        msg_enable;           /*    56     2 */

        /* XXX 2 bytes hole, try to pack */

        enum enetc_active_offloads active_offloads;      /*    60     4 */
        /* --- cacheline 1 boundary (64 bytes) --- */
        u32                        speed;                /*    64     4 */

        /* XXX 4 bytes hole, try to pack */

        struct enetc_bdr * *       xdp_tx_ring;          /*    72     8 */
        struct enetc_bdr *         tx_ring[16];          /*    80   128 */
        /* --- cacheline 3 boundary (192 bytes) was 16 bytes ago --- */
        struct enetc_bdr *         rx_ring[16];          /*   208   128 */
        /* --- cacheline 5 boundary (320 bytes) was 16 bytes ago --- */
        const struct enetc_bdr_resource  * tx_res;       /*   336     8 */
        const struct enetc_bdr_resource  * rx_res;       /*   344     8 */
        struct enetc_cls_rule *    cls_rules;            /*   352     8 */
        struct psfp_cap            psfp_cap;             /*   360    20 */
        unsigned int               min_num_stack_tx_queues; /*   380     4 */
        /* --- cacheline 6 boundary (384 bytes) --- */
        struct phylink *           phylink;              /*   384     8 */
        int                        ic_mode;              /*   392     4 */
        u32                        tx_ictt;              /*   396     4 */
        struct bpf_prog *          xdp_prog;             /*   400     8 */
        long unsigned int          flags;                /*   408     8 */
        struct work_struct         tx_onestep_tstamp;    /*   416     0 */

        /* XXX 32 bytes hole, try to pack */

        /* --- cacheline 7 boundary (448 bytes) --- */
        struct sk_buff_head        tx_skbs;              /*   448     0 */

        /* size: 472, cachelines: 8, members: 27 */
        /* sum members: 406, holes: 4, sum holes: 42 */
        /* padding: 24 */
        /* last cacheline: 24 bytes */
};

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ