Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752889AbdDJJAJ (ORCPT ); Mon, 10 Apr 2017 05:00:09 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45216 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750989AbdDJJAH (ORCPT ); Mon, 10 Apr 2017 05:00:07 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1EF6EF11AF Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=vkuznets@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 1EF6EF11AF From: Vitaly Kuznetsov To: Jork Loeser Cc: "devel\@linuxdriverproject.org" , "x86\@kernel.org" , "linux-kernel\@vger.kernel.org" , "KY Srinivasan" , Haiyang Zhang , Stephen Hemminger , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Steven Rostedt Subject: Re: [PATCH 4/7] x86/hyperv: implement rep hypercalls References: <20170407112701.17157-1-vkuznets@redhat.com> <20170407112701.17157-5-vkuznets@redhat.com> Date: Mon, 10 Apr 2017 11:00:00 +0200 In-Reply-To: (Jork Loeser's message of "Fri, 7 Apr 2017 19:48:06 +0000") Message-ID: <87zifo8wof.fsf@vitty.brq.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Mon, 10 Apr 2017 09:00:07 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1714 Lines: 44 Jork Loeser writes: >> -----Original Message----- >> From: Vitaly Kuznetsov [mailto:vkuznets@redhat.com] >> Sent: Friday, April 7, 2017 04:27 >> To: devel@linuxdriverproject.org; x86@kernel.org >> Cc: linux-kernel@vger.kernel.org; KY Srinivasan ; >> Haiyang Zhang ; Stephen Hemminger >> ; Thomas Gleixner ; Ingo >> Molnar ; H. Peter Anvin ; Steven >> Rostedt ; Jork Loeser >> Subject: [PATCH 4/7] x86/hyperv: implement rep hypercalls > >> diff --git a/arch/x86/include/asm/mshyperv.h >> b/arch/x86/include/asm/mshyperv.h index 9a5f58b..a2c996b 100644 >> --- a/arch/x86/include/asm/mshyperv.h >> +++ b/arch/x86/include/asm/mshyperv.h >> @@ -4,6 +4,7 @@ >> #include >> #include >> #include >> +#include >> #include >> >> /* >> @@ -253,6 +254,26 @@ static inline u64 hv_do_fast_hypercall8(u16 code, >> u64 input1) #endif } >> >> +static inline u64 hv_do_rep_hypercall(u16 code, u16 rep_count, void >> *input, >> + void *output) >> +{ >> + union hv_hypercall_input hc_input = { .code = code, >> + .rep_count = rep_count}; > > Is there a way to statically verify the re-count not to exceed 12 bits? Could a dynamic check be justified? Perhaps a function comment? I'd like to avoid dynamic checks here to keep this as fast as possible. Static check is probably not an option as even the only user we have now calculates this parameter dynamically. I'll add a comment to the function, thanks! -- Vitaly