From: Damien Le Moal <dlemoal@kernel.org>
To: Bart Van Assche <bvanassche@acm.org>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
James Bottomley <James.Bottomley@HansenPartnership.com>,
linux-scsi@vger.kernel.org, linux-ide@vger.kernel.org
Cc: Phillip Susi <phill@thesusis.net>
Subject: Re: [PATCH 1/2] scsi: Change scsi device boolean fields to single bit flags
Date: Tue, 21 Nov 2023 07:53:48 +0900 [thread overview]
Message-ID: <8b9d4663-dca5-496a-a173-feb5d7bf01bc@kernel.org> (raw)
In-Reply-To: <6e72b067-15a3-47e2-98c3-fdeed054dfba@acm.org>
On 11/21/23 01:06, Bart Van Assche wrote:
> On 11/19/23 23:35, Damien Le Moal wrote:
>> diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
>> index 10480eb582b2..1fb460dfca0c 100644
>> --- a/include/scsi/scsi_device.h
>> +++ b/include/scsi/scsi_device.h
>> @@ -167,19 +167,19 @@ struct scsi_device {
>> * power state for system suspend/resume (suspend to RAM and
>> * hibernation) operations.
>> */
>> - bool manage_system_start_stop;
>> + unsigned manage_system_start_stop:1;
>>
>> /*
>> * If true, let the high-level device driver (sd) manage the device
>> * power state for runtime device suspand and resume operations.
>> */
>> - bool manage_runtime_start_stop;
>> + unsigned manage_runtime_start_stop:1;
>>
>> /*
>> * If true, let the high-level device driver (sd) manage the device
>> * power state for system shutdown (power off) operations.
>> */
>> - bool manage_shutdown;
>> + unsigned manage_shutdown:1;
>>
>> unsigned removable:1;
>> unsigned changed:1; /* Data invalid due to media change */
>
> Is there any code that modifies the above flags from different
> threads simultaneously? I'm wondering whether this patch introduces
> one or more race conditions related to changing these flags.
These are set once when the LLD probes and initialize the scsi device and never
changed again by the LLD. The manage_xxx_start_stop flags can be changed through
sysfs though, but doing so would be a mistake as things would stop working as
expected... I do think that we should change these flags to be RO in sysfs.
Note that only libata and the firewire/sbp2 driver use these flags.
>
> Thanks,
>
> Bart.
--
Damien Le Moal
Western Digital Research
next prev parent reply other threads:[~2023-11-20 22:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-20 7:35 [PATCH 0/2] Fix runtime suspended device resume Damien Le Moal
2023-11-20 7:35 ` [PATCH 1/2] scsi: Change scsi device boolean fields to single bit flags Damien Le Moal
2023-11-20 16:06 ` Bart Van Assche
2023-11-20 22:53 ` Damien Le Moal [this message]
2023-11-20 7:35 ` [PATCH 2/2] scsi: sd: fix system start for ATA devices Damien Le Moal
2023-11-20 8:50 ` Sergey Shtylyov
2023-11-20 9:00 ` Damien Le Moal
2023-11-20 12:41 ` Niklas Cassel
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=8b9d4663-dca5-496a-a173-feb5d7bf01bc@kernel.org \
--to=dlemoal@kernel.org \
--cc=James.Bottomley@HansenPartnership.com \
--cc=bvanassche@acm.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=phill@thesusis.net \
/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