Просмотр исходного кода

Align ipc on 8 byte boundaries

Align all ipc messages on 8 byte boundaries.  This alignment will remove bus
errors on systems that can't access non-byte aligned data and should improve
performance.

Signed-off-by: Steven Dake <sdake@redhat.com>
Reviewed-by: Angus Salkeld <asalkeld@redhat.com>
Steven Dake 15 лет назад
Родитель
Сommit
556007620d
2 измененных файлов с 4 добавлено и 2 удалено
  1. 1 1
      exec/coroipcs.c
  2. 3 1
      lib/coroipcc.c

+ 1 - 1
exec/coroipcs.c

@@ -1242,7 +1242,7 @@ static void memcpy_dwrap (struct conn_info *conn_info, void *msg, unsigned int l
 	write_idx = conn_info->control_buffer->write;
 
 	memcpy (&conn_info->dispatch_buffer[write_idx], msg, len);
-	conn_info->control_buffer->write = (write_idx + len) % conn_info->dispatch_size;
+	conn_info->control_buffer->write = ((write_idx + len + 7) & 0xFFFFFFFF8) % conn_info->dispatch_size;
 }
 
 static void msg_send (void *conn, const struct iovec *iov, unsigned int iov_len,

+ 3 - 1
lib/coroipcc.c

@@ -932,7 +932,9 @@ retry_ipc_sem_wait:
 	read_idx = ipc_instance->control_buffer->read;
 	header = (coroipc_response_header_t *) &addr[read_idx];
 	ipc_instance->control_buffer->read =
-		(read_idx + header->size) % ipc_instance->dispatch_size;
+		((read_idx + header->size + 7) & 0xFFFFFFF8) %
+			ipc_instance->dispatch_size;
+
 	/*
 	 * Put from dispatch get and also from this call's get
 	 */