All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Stefano Stabellini <stefano@aporeto.com>
Cc: jgross@suse.com, lars.kurth@citrix.com, wei.liu2@citrix.com,
	andrew.cooper3@citrix.com, Paul.Durrant@citrix.com,
	xen-devel@lists.xenproject.org, joao.m.martins@oracle.com,
	boris.ostrovsky@oracle.com, roger.pau@citrix.com
Subject: Re: [DOC v6] PV Calls protocol design
Date: Wed, 12 Oct 2016 12:06:05 -0400	[thread overview]
Message-ID: <20161012160605.GF8102@char.us.oracle.com> (raw)
In-Reply-To: <alpine.DEB.2.10.1610101718080.4018@sstabellini-ThinkPad-X260>

> > > ### Data ring
> > > 
> > > Data rings are used for sending and receiving data over a connected socket. They
> > > are created upon a successful **accept** or **connect** command.
> > > 
> > > A data ring is composed of two pieces: the interface and the **in** and **out**
> > > buffers. The interface, represented by `struct pvcalls_ring_intf` is shared
> > > first and resides on the page whose grant reference is passed by **accept** and
> > > **connect** as parameter. `struct pvcalls_ring_intf` contains the list of grant
> > > references which constitute the **in** and **out** data buffers.
> > > 
> > > #### Data ring interface
> > > 
> > >     struct pvcalls_data_intf {
> > >     	PVCALLS_RING_IDX in_cons, in_prod;
> > 
> > Do you want to add some spacing between them so that you don't
> > use the same cacheline?
> 
> Let me get this straight. in_cons and in_prod should be on the same
> cacheline.  Similarly out_cons and out_prod should be on the same
> cacheline, but on a different cacheline compared to in_cons and in_prod.
> 
> So I should add padding between the two pairs of indices. Something
> like:
>             uint8_t pad[cache_line_size - 8];
> 
> Where cache_line_size is usually 64 bytes. So this would be:
> 
>             uint8_t pad[56];
> 
> Is that right?

Sounds right. But pahole will for sure confirm :-) I was too lazy to copy this in code and see
what it gives you.
> 
> 
> > >     	PVCALLS_RING_IDX out_cons, out_prod;
> > >     	int32_t in_error, out_error;
> > >     
> > >     	uint32_t ring_order;
> > >     	grant_ref_t ref[];
> > >     };
> > 
> > That does not look like it would be to the power of two? Perhaps
> > some padding?
> 
> I don't understand the suggestion about the padding here.

You pad[56] takes care of the issue I had.

..snipp.
> > > The binary layout of `struct pvcalls_data_intf` follows:
> > > 
> > >     0         4         8         12        16        20        24        28
> > >     +---------+---------+---------+---------+---------+---------+----------+
> > >     | in_cons | in_prod |out_cons |out_prod |in_error |out_error|ring_order|
> > >     +---------+---------+---------+---------+---------+---------+----------+
> > > 
> > >     28        32        36        40        4092     4096
> > >     +---------+---------+---------+----//---+---------+
> > >     |  ref[0] |  ref[1] |  ref[2] |         |  ref[N] |
> > >     +---------+---------+---------+----//---+---------+
> > 
> > Perhaps you can say:
> > 
> > **N.B** For one page, the N would be 2034.
> 
> I can do that but actually N would be (4096-28)/4 = 1017. Ring refs are
> 4 bytes each.

I somehow had uint16_t on my mind! Thanks for checking me!

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

      reply	other threads:[~2016-10-12 16:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-14 23:45 [DOC v6] PV Calls protocol design Stefano Stabellini
2016-09-29  1:10 ` Konrad Rzeszutek Wilk
2016-10-11 22:01   ` Stefano Stabellini
2016-10-12 16:06     ` Konrad Rzeszutek Wilk [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20161012160605.GF8102@char.us.oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=Paul.Durrant@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=jgross@suse.com \
    --cc=joao.m.martins@oracle.com \
    --cc=lars.kurth@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=stefano@aporeto.com \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.