From: Pavel Skripkin <paskripkin@gmail.com>
To: David Laight <David.Laight@ACULAB.COM>,
Michael Straube <straube.linux@gmail.com>,
"Fabio M. De Francesco" <fmdefrancesco@gmail.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
Larry Finger <Larry.Finger@lwfinger.net>,
Phillip Potter <phil@philpotter.co.uk>,
"open list:STAGING SUBSYSTEM" <linux-staging@lists.linux.dev>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: staging: r8188eu: how to handle nested mutex under spinlock
Date: Mon, 4 Apr 2022 20:12:31 +0300 [thread overview]
Message-ID: <6771d68a-5251-4fb1-cecb-a0d2f32faf36@gmail.com> (raw)
In-Reply-To: <e1ab34f940234eecb91b9b262062eda5@AcuMS.aculab.com>
[-- Attachment #1.1: Type: text/plain, Size: 1214 bytes --]
Hi David,
On 4/4/22 19:59, David Laight wrote:
> From: Pavel Skripkin
>> Sent: 04 April 2022 17:39
>>
>> Hi David,
>>
>> On 4/4/22 11:50, David Laight wrote:
>> >>
>> >> > while (pwrpriv->bInSuspend &&
>> >>
>> >> I've looked into what gcc11 produced from this function and looks like
>> >> my compiler is smart enough to not cache that value, but I am afraid not
>> >> all compilers are that smart.
>> >
>> > The compiler can't cache the value because of the function call.
>> >
>>
>> Hm, I am a newbie in compilers, so can you, please, explain (or give a
>> link to any resource where I can read about it) how function call here
>> prevent caching.
>>
>> IIUC compiler generates code that works well in scope of single-threaded
>> application, so why can't compiler cache that value instead of accessing
>> memory on each iteration... Isn't register access a way faster than even
>> cache hit?
>
> Because calls to external functions are allowed to change
> any data via 'other' references.
> For instance the structure pointer the function has could
> also be in global data somewhere.
>
Make sense, thank you for explanation!
With regards,
Pavel Skripkin
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
next prev parent reply other threads:[~2022-04-04 21:23 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-02 20:47 staging: r8188eu: how to handle nested mutex under spinlock Michael Straube
2022-04-02 21:13 ` Pavel Skripkin
2022-04-02 21:32 ` Larry Finger
2022-04-03 8:44 ` Michael Straube
[not found] ` <4389354.LvFx2qVVIh@leap>
[not found] ` <1813843.tdWV9SEqCh@leap>
2022-04-03 11:08 ` Michael Straube
[not found] ` <7365301.EvYhyI6sBW@leap>
2022-04-03 11:41 ` Michael Straube
2022-04-03 11:48 ` Pavel Skripkin
[not found] ` <1817830.CQOukoFCf9@leap>
2022-04-03 12:14 ` Michael Straube
2022-04-03 12:19 ` Pavel Skripkin
[not found] ` <4412825.cEBGB3zze1@leap>
2022-04-03 12:45 ` Pavel Skripkin
[not found] ` <2029549.KlZ2vcFHjT@leap>
2022-04-03 13:02 ` Pavel Skripkin
2022-04-03 20:51 ` Michael Straube
2022-04-03 21:15 ` Pavel Skripkin
2022-04-04 8:50 ` David Laight
2022-04-04 16:38 ` Pavel Skripkin
2022-04-04 16:59 ` David Laight
2022-04-04 17:12 ` Pavel Skripkin [this message]
[not found] ` <1858641.taCxCBeP46@leap>
[not found] ` <2366209.jE0xQCEvom@leap>
2022-04-03 12:18 ` Michael Straube
2022-04-04 13:33 ` Dan Carpenter
2022-04-04 14:16 ` Michael Straube
[not found] ` <3097543.5fSG56mABF@leap>
2022-04-03 11:44 ` Michael Straube
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=6771d68a-5251-4fb1-cecb-a0d2f32faf36@gmail.com \
--to=paskripkin@gmail.com \
--cc=David.Laight@ACULAB.COM \
--cc=Larry.Finger@lwfinger.net \
--cc=fmdefrancesco@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=phil@philpotter.co.uk \
--cc=straube.linux@gmail.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