From: Marco Pagani <marpagan@redhat.com>
To: Moritz Fischer <mdf@kernel.org>, Wu Hao <hao.wu@intel.com>,
Xu Yilun <yilun.xu@intel.com>, Tom Rix <trix@redhat.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Marco Pagani <marpagan@redhat.com>,
linux-kernel@vger.kernel.org, linux-fpga@vger.kernel.org
Subject: [RFC PATCH v2 0/2] fpga: improve protection against low-level modules unloading
Date: Fri, 24 Nov 2023 17:28:05 +0100 [thread overview]
Message-ID: <20231124162807.238724-1-marpagan@redhat.com> (raw)
This RFC proposes a possible solution to keep protecting the fpga
manager against the sudden unloading of low-level control modules while
addressing the limitations of the current implementation. Currently, the
code assumes that the low-level module registers a platform driver for
the parent device, which can later be used by the fpga manager (through
the parent device pointer) to take the low-level module's refcount. This
proposal removes this limitation by adding a module owner field to the
fpga_manager and fpga_manager_ops structs. Low-level control modules can
statically set the owner field to THIS_MODULE. Later, the fpga manager
can use the owner field to take the module's refcount.
For more context, please refer to these threads:
https://lore.kernel.org/linux-fpga/ZS6hhlvjUcqyv8zL@yilunxu-OptiPlex-7050
https://lore.kernel.org/linux-fpga/ZT9qENE9fE3Z0KCW@yilunxu-OptiPlex-7050
v2:
- Fixed protection against races during module removal
Marco Pagani (2):
fpga: add a module owner field to fpga_manager and fpga_manager_ops
fpga: set owner of fpga_manager_ops for existing low-level modules
drivers/fpga/altera-cvp.c | 1 +
drivers/fpga/altera-pr-ip-core.c | 1 +
drivers/fpga/altera-ps-spi.c | 1 +
drivers/fpga/dfl-fme-mgr.c | 1 +
drivers/fpga/fpga-mgr.c | 56 +++++++++++++++++++--------
drivers/fpga/ice40-spi.c | 1 +
drivers/fpga/lattice-sysconfig.c | 1 +
drivers/fpga/machxo2-spi.c | 1 +
drivers/fpga/microchip-spi.c | 1 +
drivers/fpga/socfpga-a10.c | 1 +
drivers/fpga/socfpga.c | 1 +
drivers/fpga/stratix10-soc.c | 1 +
drivers/fpga/tests/fpga-mgr-test.c | 1 +
drivers/fpga/tests/fpga-region-test.c | 1 +
drivers/fpga/ts73xx-fpga.c | 1 +
drivers/fpga/versal-fpga.c | 1 +
drivers/fpga/xilinx-spi.c | 1 +
drivers/fpga/zynq-fpga.c | 1 +
drivers/fpga/zynqmp-fpga.c | 1 +
include/linux/fpga/fpga-mgr.h | 4 ++
20 files changed, 62 insertions(+), 16 deletions(-)
base-commit: 98b1cc82c4affc16f5598d4fa14b1858671b2263
--
2.42.0
next reply other threads:[~2023-11-24 16:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-24 16:28 Marco Pagani [this message]
2023-11-24 16:28 ` [RFC PATCH v2 1/2] fpga: add a module owner field to fpga_manager and fpga_manager_ops Marco Pagani
2023-11-25 9:11 ` Xu Yilun
2023-11-30 10:42 ` Marco Pagani
2023-12-02 12:16 ` Xu Yilun
2023-12-08 20:08 ` Marco Pagani
2023-12-09 15:27 ` Xu Yilun
2023-12-16 9:35 ` Marco Pagani
2023-11-24 16:28 ` [RFC PATCH v2 2/2] fpga: set owner of fpga_manager_ops for existing low-level modules Marco Pagani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231124162807.238724-1-marpagan@redhat.com \
--to=marpagan@redhat.com \
--cc=gregkh@linuxfoundation.org \
--cc=hao.wu@intel.com \
--cc=linux-fpga@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mdf@kernel.org \
--cc=trix@redhat.com \
--cc=yilun.xu@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).