* sync_set_bit() vs set_bit() -- what's the difference?
@ 2014-08-27 7:30 Dexuan Cui
2014-08-27 7:38 ` Jürgen Groß
2014-08-27 7:38 ` Jan Beulich
0 siblings, 2 replies; 6+ messages in thread
From: Dexuan Cui @ 2014-08-27 7:30 UTC (permalink / raw)
To: KY Srinivasan, chrisw@sous-sol.org, jeremy@goop.org, Jan Beulich
Cc: linux-kernel@vger.kernel.org
I'm curious about the difference. :-)
sync_set_bit() is only used in drivers/hv/ and drivers/xen/ while set_bit() is used in all other places. What makes hv/xen special?
Thanks,
-- Dexuan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: sync_set_bit() vs set_bit() -- what's the difference?
2014-08-27 7:30 sync_set_bit() vs set_bit() -- what's the difference? Dexuan Cui
@ 2014-08-27 7:38 ` Jürgen Groß
2014-08-27 7:38 ` Jan Beulich
1 sibling, 0 replies; 6+ messages in thread
From: Jürgen Groß @ 2014-08-27 7:38 UTC (permalink / raw)
To: Dexuan Cui, KY Srinivasan, chrisw@sous-sol.org, jeremy@goop.org,
Jan Beulich
Cc: linux-kernel@vger.kernel.org
On 08/27/2014 09:30 AM, Dexuan Cui wrote:
> I'm curious about the difference. :-)
>
> sync_set_bit() is only used in drivers/hv/ and drivers/xen/ while set_bit() is used in all other places. What makes hv/xen special?
In set_bit() the "lock" prefix will be dropped if only one processor is
present. sync_set_bit() is always attributed with "lock".
xen and hv might require "lock" semantics even if the current OS is
running on only one processor, as syncing with other processors running
other OS's might be necessary.
Juergen
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: sync_set_bit() vs set_bit() -- what's the difference?
2014-08-27 7:30 sync_set_bit() vs set_bit() -- what's the difference? Dexuan Cui
2014-08-27 7:38 ` Jürgen Groß
@ 2014-08-27 7:38 ` Jan Beulich
2014-08-27 7:50 ` Dexuan Cui
2014-08-27 13:56 ` KY Srinivasan
1 sibling, 2 replies; 6+ messages in thread
From: Jan Beulich @ 2014-08-27 7:38 UTC (permalink / raw)
To: Dexuan Cui
Cc: jeremy@goop.org, KY Srinivasan, chrisw@sous-sol.org,
linux-kernel@vger.kernel.org
>>> On 27.08.14 at 09:30, <decui@microsoft.com> wrote:
> I'm curious about the difference. :-)
>
> sync_set_bit() is only used in drivers/hv/ and drivers/xen/ while set_bit()
> is used in all other places. What makes hv/xen special?
I guess this would really want to be used by anything communicating
with a hypervisor or a remote driver: set_bit() gets its LOCK prefix
discarded when the local kernel determines it runs on a single CPU
only. Obviously having knowledge of the CPU count inside a VM does
not imply anything about the number of CPUs available to the host,
i.e. stripping LOCK prefixes in that case would be unsafe.
Jan
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: sync_set_bit() vs set_bit() -- what's the difference?
2014-08-27 7:38 ` Jan Beulich
@ 2014-08-27 7:50 ` Dexuan Cui
2014-08-27 7:58 ` Jürgen Groß
2014-08-27 13:56 ` KY Srinivasan
1 sibling, 1 reply; 6+ messages in thread
From: Dexuan Cui @ 2014-08-27 7:50 UTC (permalink / raw)
To: Jan Beulich
Cc: jeremy@goop.org, KY Srinivasan, chrisw@sous-sol.org,
linux-kernel@vger.kernel.org
> -----Original Message-----
> From: Jan Beulich
> Sent: Wednesday, August 27, 2014 15:39 PM
> >>> On 27.08.14 at 09:30, <decui@microsoft.com> wrote:
> > I'm curious about the difference. :-)
> >
> > sync_set_bit() is only used in drivers/hv/ and drivers/xen/ while set_bit()
> > is used in all other places. What makes hv/xen special?
>
> I guess this would really want to be used by anything communicating
> with a hypervisor or a remote driver: set_bit() gets its LOCK prefix
> discarded when the local kernel determines it runs on a single CPU
> only. Obviously having knowledge of the CPU count inside a VM does
> not imply anything about the number of CPUs available to the host,
> i.e. stripping LOCK prefixes in that case would be unsafe.
>
> Jan
Thank you, Juergen and Jan for your quick answers!
I didn't realize LOCK_PREFIX is "" for UP. :-)
Thanks,
-- Dexuan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: sync_set_bit() vs set_bit() -- what's the difference?
2014-08-27 7:50 ` Dexuan Cui
@ 2014-08-27 7:58 ` Jürgen Groß
0 siblings, 0 replies; 6+ messages in thread
From: Jürgen Groß @ 2014-08-27 7:58 UTC (permalink / raw)
To: Dexuan Cui, Jan Beulich
Cc: jeremy@goop.org, KY Srinivasan, chrisw@sous-sol.org,
linux-kernel@vger.kernel.org
On 08/27/2014 09:50 AM, Dexuan Cui wrote:
>> -----Original Message-----
>> From: Jan Beulich
>> Sent: Wednesday, August 27, 2014 15:39 PM
>>>>> On 27.08.14 at 09:30, <decui@microsoft.com> wrote:
>>> I'm curious about the difference. :-)
>>>
>>> sync_set_bit() is only used in drivers/hv/ and drivers/xen/ while set_bit()
>>> is used in all other places. What makes hv/xen special?
>>
>> I guess this would really want to be used by anything communicating
>> with a hypervisor or a remote driver: set_bit() gets its LOCK prefix
>> discarded when the local kernel determines it runs on a single CPU
>> only. Obviously having knowledge of the CPU count inside a VM does
>> not imply anything about the number of CPUs available to the host,
>> i.e. stripping LOCK prefixes in that case would be unsafe.
>>
>> Jan
>
> Thank you, Juergen and Jan for your quick answers!
>
> I didn't realize LOCK_PREFIX is "" for UP. :-)
Even worse: it is patched away dynamically when you disable all but one
processor and activated again when a second processor is becoming
active.
Juergen
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: sync_set_bit() vs set_bit() -- what's the difference?
2014-08-27 7:38 ` Jan Beulich
2014-08-27 7:50 ` Dexuan Cui
@ 2014-08-27 13:56 ` KY Srinivasan
1 sibling, 0 replies; 6+ messages in thread
From: KY Srinivasan @ 2014-08-27 13:56 UTC (permalink / raw)
To: Jan Beulich, Dexuan Cui
Cc: jeremy@goop.org, chrisw@sous-sol.org,
linux-kernel@vger.kernel.org
> -----Original Message-----
> From: Jan Beulich [mailto:JBeulich@suse.com]
> Sent: Wednesday, August 27, 2014 12:39 AM
> To: Dexuan Cui
> Cc: jeremy@goop.org; KY Srinivasan; chrisw@sous-sol.org; linux-
> kernel@vger.kernel.org
> Subject: Re: sync_set_bit() vs set_bit() -- what's the difference?
>
> >>> On 27.08.14 at 09:30, <decui@microsoft.com> wrote:
> > I'm curious about the difference. :-)
> >
> > sync_set_bit() is only used in drivers/hv/ and drivers/xen/ while
> > set_bit() is used in all other places. What makes hv/xen special?
>
> I guess this would really want to be used by anything communicating with a
> hypervisor or a remote driver: set_bit() gets its LOCK prefix discarded when
> the local kernel determines it runs on a single CPU only. Obviously having
> knowledge of the CPU count inside a VM does not imply anything about the
> number of CPUs available to the host, i.e. stripping LOCK prefixes in that case
> would be unsafe.
That is exactly the case for Hyper-V (and Xen).
K. Y
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2014-08-27 13:56 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-27 7:30 sync_set_bit() vs set_bit() -- what's the difference? Dexuan Cui
2014-08-27 7:38 ` Jürgen Groß
2014-08-27 7:38 ` Jan Beulich
2014-08-27 7:50 ` Dexuan Cui
2014-08-27 7:58 ` Jürgen Groß
2014-08-27 13:56 ` KY Srinivasan
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.