BPF Archive on lore.kernel.org
 help / color / Atom feed
* [BPF TOPIC] BPF Memory Model
@ 2020-02-10 16:18 Paul E. McKenney
  0 siblings, 0 replies; only message in thread
From: Paul E. McKenney @ 2020-02-10 16:18 UTC (permalink / raw)
  To: bpf, lsf-pc; +Cc: kernel-team

BPF Memory Model
================

Now that BPF supports concurrency, the issue of memory ordering is
with us.  This issue will become more pressing as additional atomic
operations are added to BPF for the following reasons:

1.	Developers will need to know how much synchronization is
	needed to make their concurrent BPF code work properly,
	regardless of the underlying hardware and compiler.

2.	A BPF memory model can be helpful in locating concurrency
	bugs and checking fixes.

Given that BPF interacts with the Linux kernel, the obvious candidate for
the BPF memory model is of course the Linux-kernel memory model (LKMM).
However, BPF will likely adopt atomic operations on an as-needed basis,
and these will need to interact not only with each other, but also with
in-kernel atomic operations.  In addition, LKMM relies on help from
coding conventions and compiler options, so some care is required to
even exactly mimic LKMM.

Some areas needing attention:

a.	Determining what in-kernel data should be accessed directly by
	BPF programs as opposed to accessed via helpers.  For example,
	in-kernel data with complex access protocols might require access
	via helpers that enforce those protocols.

b.	Deciding what types of verification should be applied to
	BPF programs and at what point in the process.
	
c.	Deciding to what extent BPF verification should be integrated
	with in-kernel validation such as lockdep and KASAN.

d.	Adapting LKMM tooling to BPF programs.

e.	Working out which atomic operations to add to BPF and in which
	order.

Tackling these issues head-on will help BPF move to concurrency with
minimal shared-variable drama.  This talk will summarize the current
state and hopefully kick of discussions leading to improved approaches
to BPF's sharing variables both within BPF and with the kernel.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-10 16:18 [BPF TOPIC] BPF Memory Model Paul E. McKenney

BPF Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/bpf/0 bpf/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 bpf bpf/ https://lore.kernel.org/bpf \
		bpf@vger.kernel.org
	public-inbox-index bpf

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.bpf


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git