From: "Jan Beulich" Subject: Re: [PATCH v7 01/21] xen: make two memory hypercalls vNUMA-aware Date: Mon, 09 Mar 2015 13:52:28 +0000 Message-ID: <54FDB3AC02000078000678CE@mail.emea.novell.com> References: <1425905497-30835-1-git-send-email-wei.liu2@citrix.com> <1425905497-30835-2-git-send-email-wei.liu2@citrix.com> <54FDACBF0200007800067886@mail.emea.novell.com> <20150309132945.GT18491@zion.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20150309132945.GT18491@zion.uk.xensource.com> Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Wei Liu Cc: AndrewCooper , xen-devel@lists.xen.org List-Id: xen-devel@lists.xenproject.org >>> On 09.03.15 at 14:29, wrote: > On Mon, Mar 09, 2015 at 01:22:55PM +0000, Jan Beulich wrote: >> >>> On 09.03.15 at 13:51, wrote: >> > @@ -759,6 +784,14 @@ long do_memory_op(unsigned long cmd, > XEN_GUEST_HANDLE_PARAM(void) arg) >> > return start_extent; >> > args.domain = d; >> > >> > + if ( construct_memop_from_reservation(d, &reservation, &args) ) >> > + { >> > + rcu_unlock_domain(d); >> > + return start_extent; >> > + } >> > + args.nr_done = start_extent; >> > + args.preempted = 0; >> >> Remembering Andrew's comment on your patch introducing >> construct_memop_from_reservation(), the setting of >> args.domain visible in the context above should either be >> moved past that call, or be used by the function instead of >> passing d explicitly (in which case it is pretty clear that the >> function isn't free to clobber that structure field). >> > > My understanding was that he wanted me to move setting args.nr_done and > args.preempted after calling construct_memop_from_reservation. But then > here I missed args.domain. :-/ > > I will just move "args.domain = d" after the function call, if that's OK > with you. Yes, as said, either adjustment is fine with me. But looking at this another time points out another issue with the patch - you now clobber MEMF_populate_on_demand possibly being set in args.memflags, i.e. you need to move down that part too. Jan