From: Daniel De Graaf <dgdegra@tycho.nsa.gov>
To: Ian Campbell <Ian.Campbell@citrix.com>
Cc: "Matthew.Fioravante@jhuapl.edu" <Matthew.Fioravante@jhuapl.edu>,
"xen-devel@lists.xen.org" <xen-devel@lists.xen.org>,
Tim Deegan <tim@xen.org>, "JBeulich@suse.com" <JBeulich@suse.com>,
"konrad.wilk@oracle.com" <konrad.wilk@oracle.com>
Subject: Re: [PATCH v5.1 01/12] mini-os/tpm{back, front}: Change shared page ABI
Date: Thu, 11 Apr 2013 11:46:53 -0400 [thread overview]
Message-ID: <5166DAED.4040005@tycho.nsa.gov> (raw)
In-Reply-To: <1365693945.8126.42.camel@zakaz.uk.xensource.com>
On 04/11/2013 11:25 AM, Ian Campbell wrote:
> On Thu, 2013-04-11 at 15:38 +0100, Daniel De Graaf wrote:
>> On 04/11/2013 10:14 AM, Ian Campbell wrote:
>>> On Fri, 2013-03-22 at 22:30 +0000, Daniel De Graaf wrote:
>>>> @@ -529,15 +526,27 @@ void free_tpmif(tpmif_t* tpmif)
>>>> void tpmback_handler(evtchn_port_t port, struct pt_regs *regs, void *data)
>>>> {
>>>> tpmif_t* tpmif = (tpmif_t*) data;
>>>> - tpmif_tx_request_t* tx = &tpmif->tx->ring[0].req;
>>>> - /* Throw away 0 size events, these can trigger from event channel unmasking */
>>>> - if(tx->size == 0)
>>>> - return;
>>>> -
>>>> - TPMBACK_DEBUG("EVENT CHANNEL FIRE %u/%u\n", (unsigned int) tpmif->domid, tpmif->handle);
>>>> - tpmif_req_ready(tpmif);
>>>> - wake_up(&waitq);
>>>> + vtpm_shared_page_t* pg = tpmif->page;
>>>>
>>>
>>> Do we not need a barrier somewhere around here to ensure that the far
>>> end's write to pg->state is visible to this cpu?
>>
>> The frontend's write to pg->state is always done prior to the frontend
>> sending its event channel notification, so an explicit barrier is not
>> needed in this function.
>
> An event channel notification might happen to include barriers as part
> of its implementation but does the interface make any guarantees?
Since it looks like other mini-os drivers use wmb() before their event
channel notifications, I'll add that to be consistent.
>> Since there is only one read and a clear
>> dependency on the one write, so I'm not sure where the barrier here
>> would need to go even if it was needed.
>
> DOMU DOM_TPM
> PRE: pg->status == IDLE
> write data
> barrier()
> write pg->status = SUBMIT (A)
> notify evtchn
>
> receive evtchn
> read pg->status (B)
> do some stuff with the data
> write pg->status (C)
>
> Don't we need some sort of memory barrier (as in rmb/wmb/mb not a
> compiler barrier()) between (A) and (B), to ensure that B sees the write
> at A and gets SUBMIT and not the previous value of IDLE?
>
> I wasn't thinking about barriers between the read at (B) and the write
> at (C), although now that you mention it a barrier might be needed
> *after* (C) so that the domU sees the vTPM as IDLE next time it come to
> use it...
>
> Ian.
--
Daniel De Graaf
National Security Agency
next prev parent reply other threads:[~2013-04-11 15:46 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-22 22:28 [PATCH RFC] drivers/tpm: add xen tpmfront interface Daniel De Graaf
2013-03-22 22:30 ` [PATCH v5.1 01/12] mini-os/tpm{back, front}: Change shared page ABI Daniel De Graaf
2013-04-11 14:00 ` Ian Campbell
2013-04-11 14:11 ` Daniel De Graaf
2013-04-11 14:14 ` Ian Campbell
2013-04-11 14:38 ` Daniel De Graaf
2013-04-11 15:25 ` Ian Campbell
2013-04-11 15:46 ` Daniel De Graaf [this message]
2013-04-11 14:27 ` Ian Campbell
2013-04-11 15:10 ` Daniel De Graaf
2013-04-11 15:22 ` Ian Campbell
2013-04-11 16:18 ` Daniel De Graaf
2013-04-11 16:20 ` [PATCH v5.2] " Daniel De Graaf
2013-04-11 14:17 ` [PATCH RFC] drivers/tpm: add xen tpmfront interface Ian Campbell
2013-04-11 14:38 ` Daniel De Graaf
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=5166DAED.4040005@tycho.nsa.gov \
--to=dgdegra@tycho.nsa.gov \
--cc=Ian.Campbell@citrix.com \
--cc=JBeulich@suse.com \
--cc=Matthew.Fioravante@jhuapl.edu \
--cc=konrad.wilk@oracle.com \
--cc=tim@xen.org \
--cc=xen-devel@lists.xen.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.