Lines Matching full:foo
220 For example, ASSERT_EXCLUSIVE_ACCESS(foo) tells KCSAN that any
221 concurrent access to variable foo by any other CPU is an error, even
223 ASSERT_EXCLUSIVE_WRITER(foo) tells KCSAN that although it is OK for there
224 to be concurrent reads from foo from other CPUs, it is an error for some
225 other CPU to be concurrently writing to foo, even if that concurrent
246 For example, suppose a shared variable "foo" is read only while a
251 int foo;
257 foo = newval;
268 ret = foo;
275 pr_info("Current value of foo: %d\n", data_race(foo));
279 bugs into any part of the main algorithm using foo, which means that
280 the accesses to foo within both update_foo() and read_foo() can (and
283 reads from or updates to foo. The data_race() in read_foo_diagnostic()
293 pr_info("Current value of foo: %d\n", data_race(READ_ONCE(foo)));
301 pr_info("Current value of foo: %d\n", READ_ONCE(foo));
307 the value of foo, you also need CONFIG_KCSAN_REPORT_VALUE_CHANGE_ONLY=n.
321 For another example, suppose a shared variable "foo" is updated only
325 int foo;
331 WRITE_ONCE(foo, newval);
332 ASSERT_EXCLUSIVE_WRITER(foo);
340 return READ_ONCE(foo);
343 Because foo is read locklessly, all accesses are marked. The purpose
359 struct foo {
364 /* All foo structures are in the following array. */
366 struct foo *foo_array;
368 void do_something_locked(struct foo *fp)
428 For this to work, only those foo structures in foo_array[] may be passed
431 every foo structure.
434 changes to a foo structure between calls to begin_global() and
444 For another example, suppose a shared variable "foo" is both read and
447 int foo;
453 ret = xchg(&foo, newval);
461 return READ_ONCE(foo);
464 Because foo is accessed locklessly, all accesses are marked. It does
467 flag any concurrent plain C-language reads from foo, and given
469 C-language writes to foo.
475 For yet another example, suppose that foo is initialized in a
477 that locklessly and concurrently access foo. Some snippets of this code
480 int foo;
486 foo = initval;
487 ASSERT_EXCLUSIVE_ACCESS(foo);
497 ret = xchg(&foo, newval);
506 return READ_ONCE(foo);
509 The initialize_foo() uses a plain C-language write to foo because there
524 int foo;
528 return xchg(&foo, newval);
535 newold = data_race(foo); /* Checked by cmpxchg(). */
539 newold = cmpxchg(&foo, old, new);
546 return READ_ONCE(foo);
554 int foo;
558 ASSERT_EXCLUSIVE_ACCESS(foo);
559 return xchg(&foo, newval);
566 newold = data_race(foo); /* Checked by cmpxchg(). */
570 ASSERT_EXCLUSIVE_ACCESS(foo);
571 newold = cmpxchg(&foo, old, new);
579 ASSERT_EXCLUSIVE_ACCESS(foo);
580 return READ_ONCE(foo);