Having looked closer at the tacked of changing out the index and data fields in some function calls for a struct parameter with these and a originator field (host or guest) it is less attractive than I thought it would be. The only place where we need to know the initiator is in kvm_write_tsc() which has an implicit index. I have been trying to determine whether there is a possibility for taking a context switch while a guest initiated set_msr() is in progress whereby the new thread might invoke the set_msr()/kvm_write_tsc() routines. It looks to me like this is not possible but I can't be sure. If it is not possible we can set a variable for the vcpu when a guest call is in progress and this would be sufficient. What do you think? Thanks, Will > -----Original Message----- > From: Will Auld [mailto:will.auld.intel@xxxxxxxxx] > Sent: Monday, October 22, 2012 2:58 PM > To: Avi Kivity > Cc: Marcelo Tosatti; Auld, Will; kvm@xxxxxxxxxxxxxxx; Zhang, Xiantao; > Liu, Jinsong > Subject: Re: [PATCH] Added call parameter to track whether invocation > originated with guest or elsewhere > > On Wed, 2012-10-17 at 16:28 +0200, Avi Kivity wrote: > > On 10/17/2012 04:09 PM, Marcelo Tosatti wrote: > > > On Wed, Oct 17, 2012 at 12:35:33PM +0200, Avi Kivity wrote: > > >> On 10/17/2012 04:10 AM, Will Auld wrote: > > >> > Signed-off-by: Will Auld <will.auld@xxxxxxxxx> > > >> > --- > > >> > > > >> > Resending to full list > > >> > > > >> > Marcelo, > > >> > > > >> > This patch is what I believe you ask for as foundational for > > >> > later patches to address IA32_TSC_ADJUST. > > >> > > > >> > > >> Please write a changelog to reflect the motivation. > > >> > > >> All those bool parameters scattered all over the place aren't very > > >> pretty. Usually we solve this with helpers that embed the > > >> parameter name (kvm_set_msr() vs. kvm_set_msr_host()) but there > are > > >> too many functions for this to work here. > > >> > > >> Marcelo, any ideas? > > > > > > Its easier to read > > > > > > kvm_x86_ops->kvm_set_msr() > > > kvm_x86_ops->kvm_set_msr_host() > > > > > > then > > > > > > kvm_x86_ops->kvm_set_msr(,false) > > > kvm_x86_ops->kvm_set_msr(,true) > > > > > > So you're right. > > > > Yes, but we have a million functions for setting MSRs. > > > > Maybe > > > > struct msr { > > bool host_requested; > > u32 index; > > u64 data; > > }; > > > > and change all the APIs to use that. > > > > > > I was working on a different solution and then saw this suggestion just > now. I like this tact and will look at it closer. > > Thanks, > > Will ��.n��������+%������w��{.n�����o�^n�r������&��z�ޗ�zf���h���~����������_��+v���)ߣ�