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: <3623a7f3-6f90-8570-5b9a-10ff56cc04e5@gmail.com>
Date:   Wed, 12 Apr 2023 18:42:16 +0100
From:   Edward Cree <ecree.xilinx@...il.com>
To:     Andrew Lunn <andrew@...n.ch>
Cc:     edward.cree@....com, linux-net-drivers@....com,
        davem@...emloft.net, kuba@...nel.org, pabeni@...hat.com,
        edumazet@...gle.com, netdev@...r.kernel.org,
        habetsm.xilinx@...il.com, sudheer.mogilappagari@...el.com
Subject: Re: [RFC PATCH v2 net-next 6/7] net: ethtool: add a mutex protecting
 RSS contexts

On 12/04/2023 18:15, Andrew Lunn wrote:
> I have to wonder if your locking model is wrong. When i look at the
> next patch, i see the driver is also using this lock. And i generally
> find that is wrong.
...
> Drivers writers should not need to worry about locking. The API
> into the driver will take the locks needed before entering the driver,
> and release them on exit.
I don't think that's possible without increasing driver complexity in
 other ways.  Essentially, for the driver to take advantage of the core
 tracking these contexts, and thus not need its own data structures to
 track them as well (like the efx->rss_context.list we remove in patch
 #7), it has to be able to access them on driver-initiated (not just
 core-initiated) events.  (The central example of this being "oh, the
 NIC MCPU just rebooted, we have to reinstall all our filters".)  And
 it needs to be able to exclude writes while it does that, not only for
 consistency but also because e.g. context deletion will free that
 memory (though I guess we could finesse that part with RCU?).
What I *could* do is add suitable wrapper functions for access to
 dev->ethtool->rss_ctx (e.g. a core equivalent of
 efx_find_rss_context_entry() that wraps the idr_find()) and have them
 assert that the lock is held (like efx_find_rss_context_entry() does);
 that would at least validate the driver locking somewhat.
But having those helper functions perform the locking themselves would
 mean going to a get/put model for managing the lifetime of the
 driver's reference (with a separate get_write for exclusive access),
 at which point it's probably harder for driver writers to understand
 than "any time you're touching rss_ctx you need to hold the rss_lock".

-ed

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ