From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mx1.redhat.com ([209.132.183.28]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1SfA6Y-0004oe-Go for kexec@lists.infradead.org; Thu, 14 Jun 2012 13:28:55 +0000 Message-ID: <4FD9E70A.9090507@redhat.com> Date: Thu, 14 Jun 2012 16:28:42 +0300 From: Avi Kivity MIME-Version: 1.0 Subject: Re: [PATCH v2 1/5] x86: Add helper variables and functions to hold VMCSINFO References: <4FB35C48.30708@cn.fujitsu.com> <4FB35CD4.3080801@cn.fujitsu.com> In-Reply-To: <4FB35CD4.3080801@cn.fujitsu.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: kexec-bounces@lists.infradead.org Errors-To: kexec-bounces+dwmw2=infradead.org@lists.infradead.org To: zhangyanfei Cc: dzickus@redhat.com, luto@mit.edu, kvm@vger.kernel.org, Joerg Roedel , mtosatti@redhat.com, kexec@lists.infradead.org, linux-kernel@vger.kernel.org, paul.gortmaker@windriver.com, ludwig.nussel@suse.de, ebiederm@xmission.com, Greg KH On 05/16/2012 10:52 AM, zhangyanfei wrote: > This patch provides a set of variables to hold the VMCSINFO and also > some helper functions to help fill the VMCSINFO. Need to document the format. > +void vmcsinfo_append_id(u32 id) > +{ > + size_t r; > + > + r = sizeof(id); > + if (r + vmcsinfo_size > vmcsinfo_max_size) > + return; > + > + memcpy(&vmcsinfo_data[vmcsinfo_size], &id, r); > + vmcsinfo_size += r; > +} > +EXPORT_SYMBOL_GPL(vmcsinfo_append_id); > + > +void vmcsinfo_append_field(u32 field, u64 offset) Why u64? It's guaranteed to fit within a page. > +{ > + size_t r; > + > + r = sizeof(field) + sizeof(offset); > + if (r + vmcsinfo_size > vmcsinfo_max_size) > + return; > + > + memcpy(&vmcsinfo_data[vmcsinfo_size], &field, sizeof(field)); > + vmcsinfo_size += sizeof(field); > + memcpy(&vmcsinfo_data[vmcsinfo_size], &offset, sizeof(offset)); > + vmcsinfo_size += sizeof(offset); Instead of this vmcsinfo_data, how about a struct with fields for the revision ID and field count, and an array for the fields? Should be a lot simpler. > +} > +EXPORT_SYMBOL_GPL(vmcsinfo_append_field); > + > +unsigned long paddr_vmcsinfo_note(void) > +{ > + return __pa((unsigned long)(char *)&vmcsinfo_note); > +} > -- error compiling committee.c: too many arguments to function _______________________________________________ kexec mailing list kexec@lists.infradead.org http://lists.infradead.org/mailman/listinfo/kexec From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH v2 1/5] x86: Add helper variables and functions to hold VMCSINFO Date: Thu, 14 Jun 2012 16:28:42 +0300 Message-ID: <4FD9E70A.9090507@redhat.com> References: <4FB35C48.30708@cn.fujitsu.com> <4FB35CD4.3080801@cn.fujitsu.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Cc: dzickus-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, luto-3s7WtUTddSA@public.gmane.org, kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Joerg Roedel , mtosatti-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, kexec-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, paul.gortmaker-CWA4WttNNZF54TAoqtyWWQ@public.gmane.org, ludwig.nussel-l3A5Bk7waGM@public.gmane.org, ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org, Greg KH To: zhangyanfei Return-path: In-Reply-To: <4FB35CD4.3080801-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: kexec-bounces-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org Errors-To: kexec-bounces+glkk-kexec=m.gmane.org-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org List-Id: kvm.vger.kernel.org On 05/16/2012 10:52 AM, zhangyanfei wrote: > This patch provides a set of variables to hold the VMCSINFO and also > some helper functions to help fill the VMCSINFO. Need to document the format. > +void vmcsinfo_append_id(u32 id) > +{ > + size_t r; > + > + r = sizeof(id); > + if (r + vmcsinfo_size > vmcsinfo_max_size) > + return; > + > + memcpy(&vmcsinfo_data[vmcsinfo_size], &id, r); > + vmcsinfo_size += r; > +} > +EXPORT_SYMBOL_GPL(vmcsinfo_append_id); > + > +void vmcsinfo_append_field(u32 field, u64 offset) Why u64? It's guaranteed to fit within a page. > +{ > + size_t r; > + > + r = sizeof(field) + sizeof(offset); > + if (r + vmcsinfo_size > vmcsinfo_max_size) > + return; > + > + memcpy(&vmcsinfo_data[vmcsinfo_size], &field, sizeof(field)); > + vmcsinfo_size += sizeof(field); > + memcpy(&vmcsinfo_data[vmcsinfo_size], &offset, sizeof(offset)); > + vmcsinfo_size += sizeof(offset); Instead of this vmcsinfo_data, how about a struct with fields for the revision ID and field count, and an array for the fields? Should be a lot simpler. > +} > +EXPORT_SYMBOL_GPL(vmcsinfo_append_field); > + > +unsigned long paddr_vmcsinfo_note(void) > +{ > + return __pa((unsigned long)(char *)&vmcsinfo_note); > +} > -- error compiling committee.c: too many arguments to function From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756031Ab2FNN3G (ORCPT ); Thu, 14 Jun 2012 09:29:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:9873 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755286Ab2FNN3E (ORCPT ); Thu, 14 Jun 2012 09:29:04 -0400 Message-ID: <4FD9E70A.9090507@redhat.com> Date: Thu, 14 Jun 2012 16:28:42 +0300 From: Avi Kivity User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120605 Thunderbird/13.0 MIME-Version: 1.0 To: zhangyanfei CC: mtosatti@redhat.com, ebiederm@xmission.com, luto@mit.edu, Joerg Roedel , dzickus@redhat.com, paul.gortmaker@windriver.com, ludwig.nussel@suse.de, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, kexec@lists.infradead.org, Greg KH Subject: Re: [PATCH v2 1/5] x86: Add helper variables and functions to hold VMCSINFO References: <4FB35C48.30708@cn.fujitsu.com> <4FB35CD4.3080801@cn.fujitsu.com> In-Reply-To: <4FB35CD4.3080801@cn.fujitsu.com> Content-Type: text/plain; charset=GB2312 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/16/2012 10:52 AM, zhangyanfei wrote: > This patch provides a set of variables to hold the VMCSINFO and also > some helper functions to help fill the VMCSINFO. Need to document the format. > +void vmcsinfo_append_id(u32 id) > +{ > + size_t r; > + > + r = sizeof(id); > + if (r + vmcsinfo_size > vmcsinfo_max_size) > + return; > + > + memcpy(&vmcsinfo_data[vmcsinfo_size], &id, r); > + vmcsinfo_size += r; > +} > +EXPORT_SYMBOL_GPL(vmcsinfo_append_id); > + > +void vmcsinfo_append_field(u32 field, u64 offset) Why u64? It's guaranteed to fit within a page. > +{ > + size_t r; > + > + r = sizeof(field) + sizeof(offset); > + if (r + vmcsinfo_size > vmcsinfo_max_size) > + return; > + > + memcpy(&vmcsinfo_data[vmcsinfo_size], &field, sizeof(field)); > + vmcsinfo_size += sizeof(field); > + memcpy(&vmcsinfo_data[vmcsinfo_size], &offset, sizeof(offset)); > + vmcsinfo_size += sizeof(offset); Instead of this vmcsinfo_data, how about a struct with fields for the revision ID and field count, and an array for the fields? Should be a lot simpler. > +} > +EXPORT_SYMBOL_GPL(vmcsinfo_append_field); > + > +unsigned long paddr_vmcsinfo_note(void) > +{ > + return __pa((unsigned long)(char *)&vmcsinfo_note); > +} > -- error compiling committee.c: too many arguments to function