From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
xen-devel <xen-devel@lists.xenproject.org>
Cc: Ian Campbell <Ian.Campbell@eu.citrix.com>,
Ian Jackson <Ian.Jackson@eu.citrix.com>,
Keir Fraser <keir@xen.org>, Tim Deegan <tim@xen.org>
Subject: Re: [PATCH v2 3/3] gnttab: clean up gnttab_set_version()
Date: Mon, 22 Jun 2015 13:01:12 +0100 [thread overview]
Message-ID: <5587F908.9030007@citrix.com> (raw)
In-Reply-To: <558811A80200007800087761@mail.emea.novell.com>
On 22/06/15 12:46, Jan Beulich wrote:
> - drop pointless nr_grant_entries() check from loop over reserved
> entries (adding suitable BUILD_BUG_ON()s to validate that)
> - adjust types
> - rename d to currd
> - formatting
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>, with one suggestion.
> @@ -2625,66 +2633,78 @@ gnttab_set_version(XEN_GUEST_HANDLE_PARA
> break;
> }
>
> - /* Preserve the first 8 entries (toolstack reserved grants) */
> - if ( gt->gt_version == 1 )
> - {
> - memcpy(reserved_entries, &shared_entry_v1(gt, 0), sizeof(reserved_entries));
> - }
> - else if ( gt->gt_version == 2 )
> + /* Preserve the first 8 entries (toolstack reserved grants). */
> + switch ( gt->gt_version )
> {
> - for ( i = 0; i < GNTTAB_NR_RESERVED_ENTRIES && i < nr_grant_entries(gt); i++ )
> + case 1:
> + memcpy(reserved_entries, &shared_entry_v1(gt, 0),
> + sizeof(reserved_entries));
> + break;
> + case 2:
> + for ( i = 0; i < GNTTAB_NR_RESERVED_ENTRIES; i++ )
> {
> - int flags = status_entry(gt, i);
> - flags |= shared_entry_v2(gt, i).hdr.flags;
> - if ((flags & GTF_type_mask) == GTF_permit_access)
> + unsigned int flags = shared_entry_v2(gt, i).hdr.flags;
> +
> + switch ( flags & GTF_type_mask )
> {
> - reserved_entries[i].flags = flags;
> + case GTF_permit_access:
> + reserved_entries[i].flags = flags | status_entry(gt, i);
> reserved_entries[i].domid = shared_entry_v2(gt, i).hdr.domid;
> reserved_entries[i].frame = shared_entry_v2(gt, i).full_page.frame;
> - }
> - else
> - {
> - if ((flags & GTF_type_mask) != GTF_invalid)
> - gdprintk(XENLOG_INFO, "d%d: bad flags %x in grant %d when switching grant version\n",
> - d->domain_id, flags, i);
> + break;
> + default:
> + gdprintk(XENLOG_INFO,
> + "bad flags %x in grant %u when switching version\n",
> + flags, i);
A 0x for flags, to avoid decimal confusion.
next prev parent reply other threads:[~2015-06-22 12:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-22 11:39 [PATCH v2 0/3] gnttab: misc adjustments Jan Beulich
2015-06-22 11:44 ` [PATCH v2 1/3 resend] gnttab: fix out of range shift count Jan Beulich
2015-06-22 11:45 ` [PATCH v2 2/3] gnttab: don't silently truncate frame numbers in gnttab_set_version() Jan Beulich
2015-06-22 11:51 ` Andrew Cooper
2015-06-22 11:46 ` [PATCH v2 3/3] gnttab: clean up gnttab_set_version() Jan Beulich
2015-06-22 12:01 ` Andrew Cooper [this message]
2015-07-06 15:59 ` [PATCH v2 0/3] gnttab: misc adjustments Ian Campbell
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=5587F908.9030007@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=Ian.Campbell@eu.citrix.com \
--cc=Ian.Jackson@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=keir@xen.org \
--cc=tim@xen.org \
--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.