From: "Jan Beulich" <JBeulich@novell.com>
To: Dongxiao Xu <dongxiao.xu@intel.com>
Cc: Jeremy Fitzhardinge <jeremy@goop.org>,
"xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
Steven Smith <steven.smith@citrix.com>,
KonradRzeszutek Wilk <konrad.wilk@oracle.com>
Subject: RE: [Pv-ops][PATCH 0/3 v3] Netback multiple threads support
Date: Tue, 04 May 2010 13:10:52 +0100 [thread overview]
Message-ID: <4BE02AEC0200007800001237@vpn.id2.novell.com> (raw)
In-Reply-To: <D5AB6E638E5A3E4B8F4406B113A5A19A1D94B535@shsmsx501.ccr.corp.intel.com>
>>> "Xu, Dongxiao" <dongxiao.xu@intel.com> 04.05.10 13:36 >>>
>Jan Beulich wrote:
>>>>> "Xu, Dongxiao" <dongxiao.xu@intel.com> 04.05.10 03:52 >>>
>>> 1. Merge "group" and "idx" into "netif->mapping", therefore
>>> page_ext is not used now.
>>
>> Open coding this seems very fragile (and even more using literal
>> constants in those code fragments).
>>
>> I'm also not convinced restricting either part to 16 bits is a good
>> thing (particularly on 64-bits, where you could easily have each part
>> use 32 bits).
>
>Do you have any suggestion on how to embed the data into
>netif->mapping?
Here is how I implemented this in our version of those patches:
/* extra field used in struct page */
union page_ext {
struct {
#if BITS_PER_LONG < 64
#define GROUP_WIDTH (BITS_PER_LONG - CONFIG_XEN_NETDEV_TX_SHIFT)
#define MAX_GROUPS ((1U << GROUP_WIDTH) - 1)
unsigned int grp:GROUP_WIDTH;
unsigned int idx:CONFIG_XEN_NETDEV_TX_SHIFT;
#else
#define MAX_GROUPS UINT_MAX
unsigned int grp, idx;
#endif
} e;
void *mapping;
};
static inline void netif_set_page_ext(struct page *pg, unsigned int group,
unsigned int idx)
{
union page_ext ext = { .e = { .grp = group + 1, .idx = idx } };
BUILD_BUG_ON(sizeof(ext) > sizeof(ext.mapping));
pg->mapping = ext.mapping;
}
static inline unsigned int netif_page_group(const struct page *pg)
{
union page_ext ext = { .mapping = pg->mapping };
return ext.e.grp - 1;
}
static inline unsigned int netif_page_index(const struct page *pg)
{
union page_ext ext = { .mapping = pg->mapping };
return ext.e.idx;
}
CONFIG_XEN_NETDEV_TX_SHIFT is something an earlier patch of
ours introduces (range limited to 5...16; certainly pv-ops could
benefit from having such too), so you will need to replace this
with a literal constant 8 for the time being.
Jan
prev parent reply other threads:[~2010-05-04 12:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-04 1:52 [Pv-ops][PATCH 0/3 v3] Netback multiple threads support Xu, Dongxiao
2010-05-04 9:38 ` Jan Beulich
2010-05-04 11:36 ` Xu, Dongxiao
2010-05-04 12:10 ` Jan Beulich [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=4BE02AEC0200007800001237@vpn.id2.novell.com \
--to=jbeulich@novell.com \
--cc=dongxiao.xu@intel.com \
--cc=jeremy@goop.org \
--cc=konrad.wilk@oracle.com \
--cc=steven.smith@citrix.com \
--cc=xen-devel@lists.xensource.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).