Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1701239
| From | Paolo Bonzini <pbonzini@redhat.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/3] jump_labels: fix concurrent static_key_enable/disable() |
| Date | 2017-08-01 18:50 +0200 |
| Message-ID | <u9IwQ-6mc-29@gated-at.bofh.it> (permalink) |
| References | <u9Hho-5Gd-31@gated-at.bofh.it> <u9Hho-5Gd-29@gated-at.bofh.it> <u9IwP-6mc-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On 01/08/2017 18:45, Peter Zijlstra wrote:
>
> Thanks for doing these patches, I hadn't come around to them yet.
>
> On Tue, Aug 01, 2017 at 05:24:04PM +0200, Paolo Bonzini wrote:
>>
>> +void static_key_enable(struct static_key *key)
>> +{
>> + STATIC_KEY_CHECK_USE();
>> + if (atomic_read(&key->enabled) > 0) {
>> + WARN_ON_ONCE(atomic_read(&key->enabled) != 1);
>> + return;
>> + }
>> +
>> + cpus_read_lock();
>> + jump_label_lock();
>> + if (atomic_read(&key->enabled) == 0) {
>> + atomic_set(&key->enabled, -1);
>> + jump_label_update(key);
>
> As per the previous discussion, should I do a patch adding barriers here
> (or using atomic_set_release()) such that we close the window where a
> concurrent inc/enable sees 1 but not all text changes?
Sure, and that applies to static_key_slow_inc as well.
Paolo
>> + atomic_set(&key->enabled, 1);
>> + }
>> + jump_label_unlock();
>> + cpus_read_unlock();
>> +}
>> +EXPORT_SYMBOL_GPL(static_key_enable);
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 1/3] jump_labels: fix concurrent static_key_enable/disable() Paolo Bonzini <pbonzini@redhat.com> - 2017-08-01 17:30 +0200
Re: [PATCH 1/3] jump_labels: fix concurrent static_key_enable/disable() Peter Zijlstra <peterz@infradead.org> - 2017-08-01 18:50 +0200
Re: [PATCH 1/3] jump_labels: fix concurrent static_key_enable/disable() Paolo Bonzini <pbonzini@redhat.com> - 2017-08-01 18:50 +0200
[tip:locking/core] jump_label: Fix concurrent static_key_enable/disable() tip-bot for Paolo Bonzini <tipbot@zytor.com> - 2017-08-10 14:20 +0200
csiph-web