[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] Can't map grant_table between domains



Thanks Wei for an answer.

>>    >> OOI why do you setup grant table again?
My intention is:
1. setup Grant Tables
Creates a gnttab setup table t, which requests a grant table with a single element, stored in the grant table variable.
>         setup_op.dom = DOMID_SELF;
>         setup_op.nr_frames = 1;
>         setup_op.frame_list = (uint64_t*)grant_table;
>         HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup_op, 1);
2. Offer grant to domain B
frame is staticaly allocated 4k mem page, shift by 12 because as I understood we need to pass mem frame number
>         grant_table[0].domid = B;
>         grant_table[0].frame = *shared_page >> 12;
>         flags = GTF_permit_access & GTF_reading & GTF_writing;
>         grant_table[0].flags = flags;

I also added wmb(); before setting flags as you suggested, but it doesn't help me.

> In any case, there is already a set of API that you can use from
> gnttab.c and gntmap.c. Why not just use those?

The reason why I don't use API now was because of education purposes, but because now is not working I will try to offer grant using API and consume/map it using my function.
As I understood I have to use these followed 3 function (init, alloc, access) to be able to offer grant (from: gnttab.h):

void init_gnttab(void);
grant_ref_t gnttab_alloc_and_grant(void **map);
grant_ref_t gnttab_grant_access(domid_t domid, unsigned long frame,
                                int readonly)

I also noticed that I got same error in dmesg if I run only mapper kernel:
(XEN) grant_table.c:830:d42v0 Bad domain (0 != 42), or risk of counter overflow 00000002, or subpage 0
my next question "is there any possibility to ensure that offerer domain succesfully offer grant?" I am checking setup_op.status but it is always 0, and also it is set after hypercall, not after writing to grant_table itself.


Many Thanks


On Mon, Aug 1, 2016 at 3:52 PM, Wei Liu <wei.liu2@xxxxxxxxxx> wrote:
On Mon, Aug 01, 2016 at 03:11:48PM +0100, gotoc io wrote:
> Hi I was trying to make communication between Two mini-os domains.
> I have offerer and mapper domains, offerer has ID=A, mapper has ID=B.
>
>
> Offerer function:
>
>         setup_op.dom = DOMID_SELF;
>         setup_op.nr_frames = 1;
>         setup_op.frame_list = (uint64_t*)grant_table;
>         HYPERVISOR_grant_table_op(GNTTABOP_setup_table, &setup_op, 1);

OOI why do you setup grant table again?

>         grant_table[0].domid = B;
>         grant_table[0].frame = *shared_page >> 12;
>         flags = GTF_permit_access & GTF_reading & GTF_writing;
>         grant_table[0].flags = flags;
>

Maybe missing some memory barriers?

See gnttab.c:gnttab_grant_access.

>
> Mapping function:
>
>         gnttab_map_grant_ref_t map_op;
>         map_op.host_addr = (uint64_t)shared_page;
>         map_op.flags = GNTMAP_host_map;
>         map_op.ref = entry;
>         map_op.dom = A;
>         HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref, &map_op,1);

This looks reasonable to me.

>
> After that I always got map_op.status == -1
> More over when I run xl dmesg I got followed error:
>
> (XEN) grant_table.c:830:d28v0 Bad domain (0 != B), or risk of counter
> overflow 00000002, or subpage 0
>
>
> Any idea what I can do in wrong way? I was trying to follow way how vTPM
> driver is working but after faced this error I can't move forward.
>

In any case, there is already a set of API that you can use from
gnttab.c and gntmap.c. Why not just use those?

Wei.

> Thanks for any help.

> _______________________________________________
> Minios-devel mailing list
> Minios-devel@xxxxxxxxxxxxxxxxxxxx
> https://lists.xenproject.org/cgi-bin/mailman/listinfo/minios-devel


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.