[PATCHv2] ibverbs: add a new IBV_ACCESS_GIFT option

Message ID 20130324154552.GA16346@redhat.com
State New
Headers show

Commit Message

Michael S. Tsirkin March 24, 2013, 3:45 p.m.
At the moment registering an MR breaks COW.  If the application does not
care that adapter sees stale data (for example, it tracks writes
reregisters and resends), it can use a new IBV_ACCESS_GIFT flag to
prevent registration from breaking COW.

The semantics are similar to that of SPLICE_F_GIFT thus the name.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

This is compiled but untested. Michael, could you please try
this patch (together with the kernel patch I'm sending separately)
and report whether setting this flag unbreaks overcommit for you?

 include/infiniband/verbs.h | 3 ++-
 man/ibv_reg_mr.3           | 5 +++++
 2 files changed, 7 insertions(+), 1 deletion(-)


diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h
index 6acfc81..3290ec9 100644
--- a/include/infiniband/verbs.h
+++ b/include/infiniband/verbs.h
@@ -290,7 +290,8 @@  enum ibv_access_flags {
-	IBV_ACCESS_MW_BIND		= (1<<4)
+	IBV_ACCESS_MW_BIND		= (1<<4),
+	IBV_ACCESS_GIFT			= (1<<6)
 struct ibv_pd {
diff --git a/man/ibv_reg_mr.3 b/man/ibv_reg_mr.3
index 7723771..3c302f0 100644
--- a/man/ibv_reg_mr.3
+++ b/man/ibv_reg_mr.3
@@ -34,6 +34,8 @@  describes the desired memory protection attributes; it is either 0 or the bitwis
 .B IBV_ACCESS_REMOTE_ATOMIC\fR Enable Remote Atomic Operation Access (if supported)
 .B IBV_ACCESS_MW_BIND\fR       Enable Memory Window Binding
+.B IBV_ACCESS_GIFT\fR          This memory is a gift to the adapter: if memory is modified after registration, the local version and data seen by the adapter through this region rkey may differ
@@ -43,6 +45,9 @@  is set, then
 must be set too.
+is only legal with remote or local read access.
 Local read access is always enabled for the MR.
 .B ibv_dereg_mr()