From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46072) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZADcX-0001yM-V6 for qemu-devel@nongnu.org; Wed, 01 Jul 2015 04:43:55 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZADcT-0003nW-Oe for qemu-devel@nongnu.org; Wed, 01 Jul 2015 04:43:53 -0400 Received: from mx1.redhat.com ([209.132.183.28]:33046) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZADcT-0003nS-JE for qemu-devel@nongnu.org; Wed, 01 Jul 2015 04:43:49 -0400 From: Juan Quintela In-Reply-To: <1434043048-4444-7-git-send-email-dgilbert@redhat.com> (David Alan Gilbert's message of "Thu, 11 Jun 2015 18:17:22 +0100") References: <1434043048-4444-1-git-send-email-dgilbert@redhat.com> <1434043048-4444-7-git-send-email-dgilbert@redhat.com> Date: Wed, 01 Jul 2015 10:43:47 +0200 Message-ID: <874mlo2rp8.fsf@neno.neno> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH v2 06/12] Translate offsets to destination address space Reply-To: quintela@redhat.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Dr. David Alan Gilbert (git)" Cc: amit.shah@redhat.com, arei.gonglei@huawei.com, qemu-devel@nongnu.org, mrhines@us.ibm.com "Dr. David Alan Gilbert (git)" wrote: > From: "Dr. David Alan Gilbert" > > The 'offset' field in RDMACompress and 'current_addr' field > in RDMARegister are commented as being offsets within a particular > RAMBlock, however they appear to actually be offsets within the > ram_addr_t space. > > The code currently assumes that the offsets on the source/destination > match, this change removes the need for the assumption for these > structures by translating the addresses into the ram_addr_t space of > the destination host. > > Note: An alternative would be to change the fields to actually > take the data they're commented for; this would potentially be > simpler but would break stream compatibility for those cases > that currently work. > > Signed-off-by: Dr. David Alan Gilbert Reviewed-by: Juan Quintela backwards compatibility, you will live with your errors forever.... > + /* > + * current_addr as passed in is an address in the local ram_addr_t > + * space, we need to translate this for the destination > + */ > + reg->key.current_addr -= local_block->offset; > + reg->key.current_addr += rdma->dest_blocks[reg->current_index].offset; I would add a function that is: rdma_adjust_offest() or something, but it needs three pointer parameters, not sure that it is any easier :-(