From: Tim Deegan Subject: Re: [PATCH 1 of 2] mem_event: pass mem_event_domain pointer to mem_event functions Date: Wed, 7 Sep 2011 15:40:42 +0100 Message-ID: <20110907144042.GE41585@ocelot.phlegethon.org> References: <4e7bcc14b76a8e37bc8e.1315397729@probook.site> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Return-path: Content-Disposition: inline In-Reply-To: <4e7bcc14b76a8e37bc8e.1315397729@probook.site> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Olaf Hering Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Hi, At 14:15 +0200 on 07 Sep (1315404929), Olaf Hering wrote: > mem_event: pass mem_event_domain pointer to mem_event functions > > Pass a struct mem_event_domain pointer to the various mem_event > functions. This will be used in a subsequent patch which creates > different ring buffers for the memshare, xenpaging and memaccess > functionality. This looks basically sound, except that in mem_event_check_ring(): > -int mem_event_check_ring(struct domain *d) > +int mem_event_check_ring(struct mem_event_domain *med, domid_t dom_id) > { > struct vcpu *curr = current; > int free_requests; > int ring_full = 1; > > - if ( !d->mem_event.ring_page ) > + if ( !med->ring_page ) > return -1; > > - mem_event_ring_lock(d); > + mem_event_ring_lock(med); > > - free_requests = RING_FREE_REQUESTS(&d->mem_event.front_ring); > - if ( d->mem_event.req_producers < free_requests ) > + free_requests = RING_FREE_REQUESTS(&med->front_ring); > + if ( med->req_producers < free_requests ) > { > - d->mem_event.req_producers++; > + med->req_producers++; > ring_full = 0; > } > > - if ( (curr->domain->domain_id == d->domain_id) && ring_full ) > + if ( (curr->domain->domain_id == dom_id) && ring_full ) > mem_event_mark_and_pause(curr); I think you should just have it take a domain and a med like the otehr functions, and have this check be ( curr->domain == d ). I'm pretty sure that checking for equal domain IDs here is just a slight oddity of the original code and not something subtle. :) Cheers, Tim.