xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: andrew.cooper3@citrix.com, wei.liu2@citrix.com,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v3 07/11] tmem: Make the uint64_t oid[3] a proper structure: tmem_oid
Date: Mon, 31 Aug 2015 11:37:20 -0400	[thread overview]
Message-ID: <20150831153720.GA9931@l.oracle.com> (raw)
In-Reply-To: <55E458E5020000780009E574@prv-mh.provo.novell.com>

On Mon, Aug 31, 2015 at 05:38:45AM -0600, Jan Beulich wrote:
> >>> On 28.08.15 at 20:53, <konrad.wilk@oracle.com> wrote:
> > @@ -2714,7 +2719,7 @@ long do_tmem_op(tmem_cli_op_t uops)
> >              write_unlock(&tmem_rwlock);
> >              read_lock(&tmem_rwlock);
> >  
> > -            oidp = (struct oid *)&op.u.gen.oid[0];
> > +            oidp = (struct tmem_oid *)&op.u.gen.oid[0];
> 
> AIUI this is going to go away later anyway, but generally I think it
> would be better to hide explicit casts like this by using container_of()
> when possible.

I am not sure if it will be possible as the structure that contains
the tmem_oid is an anonymous structure within an union:

struct tmem_op {
    blah
    union {
	struct {
		tmem_oid_t oid;
	} gen;
    } u;
}

And the 'container_of' macro looks to require only one level of
nesting.
> 
> > --- a/xen/include/public/sysctl.h
> > +++ b/xen/include/public/sysctl.h
> > @@ -737,6 +737,12 @@ DEFINE_XEN_GUEST_HANDLE(xen_sysctl_psr_cat_op_t);
> >  #define XEN_SYSCTL_TMEM_OP_RESTORE_PUT_PAGE       32
> >  #define XEN_SYSCTL_TMEM_OP_RESTORE_FLUSH_PAGE     33
> >  
> > +struct tmem_oid {
> > +    uint64_t oid[3];
> > +};
> > +typedef struct tmem_oid tmem_oid_t;
> > +DEFINE_XEN_GUEST_HANDLE(tmem_oid_t);
> 
> I know this is going to be a boring mechanical thing, but I'd really
> like to see this to be xen_tmem_oid (and alike), especially since
> you intend to also use the type for th non-tools part of the
> interface.

This throws a wrench in the compat autogeneration tool.

I keep on getting:

Fields of 'compat_xen_tmem_oid' not found in 'compat/tmem.h'
and it failing to generate compat/.xlat/tmem.h file. Sticking an prefix of
xen to the 'common/compat/tmem_xen.c' or just leaving it as is did not help:


 #include <xen/hypercall.h>
 #include <compat/tmem.h>
 
-#define xen_tmem_op tmem_op
-/*CHECK_tmem_op;*/
-#undef xen_tmem_op
+#define xen_xen_tmem_oid xen_tmem_oid
+CHECK_xen_tmem_oid;
+#undef xen_xen_tmem_oid

Thoughts?
> 
> Jan
> 

  reply	other threads:[~2015-08-31 15:37 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-28 18:53 [PATCH v3] Tmem bug-fixes and cleanups Konrad Rzeszutek Wilk
2015-08-28 18:53 ` [PATCH v3 01/11] tmem: Don't crash/hang/leak hypervisor when using shared pools within an guest Konrad Rzeszutek Wilk
2015-08-28 18:53 ` [PATCH v3 02/11] tmem: Add ASSERT in obj_rb_insert for pool->rwlock lock Konrad Rzeszutek Wilk
2015-08-31 11:24   ` Jan Beulich
2015-08-28 18:53 ` [PATCH v3 03/11] tmem: Remove in xc_tmem_control_oid duplicate set_xen_guest_handle call Konrad Rzeszutek Wilk
2015-08-28 18:53 ` [PATCH v3 04/11] tmem: Remove xc_tmem_control mystical arg3 Konrad Rzeszutek Wilk
2015-08-28 18:53 ` [PATCH v3 05/11] tmem: Move TMEM_CONTROL subop of tmem hypercall to sysctl Konrad Rzeszutek Wilk
2015-08-31 11:32   ` Jan Beulich
2015-08-28 18:53 ` [PATCH v3 06/11] tmem: Remove the old tmem control XSM checks as it is part of sysctl hypercall Konrad Rzeszutek Wilk
2015-08-28 18:53 ` [PATCH v3 07/11] tmem: Make the uint64_t oid[3] a proper structure: tmem_oid Konrad Rzeszutek Wilk
2015-08-31 11:38   ` Jan Beulich
2015-08-31 15:37     ` Konrad Rzeszutek Wilk [this message]
2015-08-31 15:56       ` Jan Beulich
2015-08-31 16:14         ` Konrad Rzeszutek Wilk
2015-09-01  7:04           ` Jan Beulich
2015-09-01 15:23             ` Konrad Rzeszutek Wilk
2015-09-01 15:54               ` Jan Beulich
2015-09-01 16:55                 ` Konrad Rzeszutek Wilk
2015-09-01 20:11                 ` Konrad Rzeszutek Wilk
2015-09-02  6:43                   ` Jan Beulich
2015-09-01 15:18           ` Konrad Rzeszutek Wilk
2015-09-01 15:37             ` Jan Beulich
2015-09-01 15:53               ` Konrad Rzeszutek Wilk
2015-08-28 18:53 ` [PATCH v3 08/11] tmem/sysctl: Use 'struct tmem_oid' for every user Konrad Rzeszutek Wilk
2015-08-31 11:42   ` Jan Beulich
2015-08-28 18:53 ` [PATCH v3 09/11] tmem: Use 'struct tmem_oid' in tmem_handle and move it to sysctl header Konrad Rzeszutek Wilk
2015-08-31 11:44   ` Jan Beulich
2015-09-01 20:12   ` Konrad Rzeszutek Wilk
2015-09-02  6:46     ` Jan Beulich
2015-08-28 18:53 ` [PATCH v3 10/11] tmem: Remove extra spaces at end and some hard tabbing Konrad Rzeszutek Wilk
2015-08-28 18:53 ` [PATCH v3 11/11] tmem: Spelling and full stop surgery Konrad Rzeszutek Wilk

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=20150831153720.GA9931@l.oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.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 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).