From: Eddie James <eajames@linux.ibm.com>
To: Joel Stanley <joel@jms.id.au>
Cc: linux-fsi@lists.ozlabs.org, linux-kernel@vger.kernel.org,
jk@ozlabs.org, alistair@popple.id.au
Subject: Re: [PATCH 1/2] fsi: core: Lock scan mutex for master index removal
Date: Thu, 8 Jun 2023 11:45:49 -0500 [thread overview]
Message-ID: <25196a3d-865f-8329-0a91-aa74dd0308c0@linux.ibm.com> (raw)
In-Reply-To: <CACPK8XcK7s44VzkDyA6O3CKKGCfSsV=nmtwkf6YwV-9ZDAx63A@mail.gmail.com>
On 5/31/23 02:47, Joel Stanley wrote:
> On Wed, 12 Apr 2023 at 18:56, Eddie James <eajames@linux.ibm.com> wrote:
>> If a master scan occurs while the master is being unregistered,
>> the devicecs may end up with incorrect and possibly duplicate names,
> typo: devices
Thanks...
>
>> resulting in kernel warnings. Ensure the master index isn't changed
>> outside of the scan mutex.
>>
>> Signed-off-by: Eddie James <eajames@linux.ibm.com>
>> ---
>> drivers/fsi/fsi-core.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/fsi/fsi-core.c b/drivers/fsi/fsi-core.c
>> index fcbf0469ce3f..18d4d68482d7 100644
>> --- a/drivers/fsi/fsi-core.c
>> +++ b/drivers/fsi/fsi-core.c
>> @@ -1354,12 +1354,12 @@ EXPORT_SYMBOL_GPL(fsi_master_register);
>>
>> void fsi_master_unregister(struct fsi_master *master)
>> {
>> + mutex_lock(&master->scan_lock);
> The ida functions are supposed to not require locking, but protecting
> against the test and changing of ->idx makes sense.
>
> Do you want to add a Fixes: line?
Sure.
>
>> if (master->idx >= 0) {
>> ida_simple_remove(&master_ida, master->idx);
> the ida_simple functions are depreciated, at some point we should
> replace them with ida_alloc/ida_free.
OK, I'll see if it makes sense to do that now.
Thanks!
Eddie
>
>> master->idx = -1;
>> }
>>
>> - mutex_lock(&master->scan_lock);
>> fsi_master_unscan(master);
>> mutex_unlock(&master->scan_lock);
>> device_unregister(&master->dev);
>> --
>> 2.31.1
>>
next prev parent reply other threads:[~2023-06-08 16:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-12 18:56 [PATCH 0/2] " Eddie James
2023-04-12 18:56 ` [PATCH 1/2] " Eddie James
2023-05-31 7:47 ` Joel Stanley
2023-06-08 16:45 ` Eddie James [this message]
2023-04-12 18:56 ` [PATCH 2/2] fsi: core: Add trace events for scan and unregister Eddie James
2023-05-31 1:52 ` Joel Stanley
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=25196a3d-865f-8329-0a91-aa74dd0308c0@linux.ibm.com \
--to=eajames@linux.ibm.com \
--cc=alistair@popple.id.au \
--cc=jk@ozlabs.org \
--cc=joel@jms.id.au \
--cc=linux-fsi@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®