From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vincent Hanquez Subject: Re: [PATCH 0/7][RFC] make xenguest save & restore functions reentrant Date: Sun, 15 Nov 2009 10:08:36 +0000 Message-ID: <4AFFD324.70302@eu.citrix.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Keir Fraser Cc: Xen Devel List-Id: xen-devel@lists.xenproject.org Keir Fraser wrote: > Rather than making the macros take extra arguments, can you make them refer > to ctx->foo instead (i.e., make it implciit the structure containing these > ex-globals is called ctx)? It avoids having to change every caller, and some > callers already have macros nested three deep and adding guest_width/max_mfn > all over the place does not help readability. I agree this isn't pretty. unfortunately i tried the route of changing the macro to get from ctx-> but the macro is used also on other files xc_core_x86.c and xc_resume.c which use the macro with the guest_width and/or p2m_size on the call stack. The only other solution I though of, would be to duplicate the value of the ex-globals on the stack like: ... int guest_width = ctx->guest_width; int p2m_size = ctx->p2m_size; ... I decided against, because it might look odd since it doesn't appear used and also means I need to track all assignment to this variable. If you prefer, I can change this patchset to do that. There's also the solution of carrying this patchset, and prettyfying some of thoses macro calls as if there were "expensive calls" just like my patch 5/7 does. > Also send also as attachments next time. I have problems applying these > patches from inline email for some reason; some chunks don't apply. yep ok. -- Vincent