From: Alexey Makhalov <alexey.makhalov@broadcom.com>
To: kirill.shutemov@linux.intel.com
Cc: linux-kernel@vger.kernel.org, virtualization@lists.linux.dev,
bp@alien8.de, hpa@zytor.com, dave.hansen@linux.intel.com,
mingo@redhat.com, tglx@linutronix.de, x86@kernel.org,
netdev@vger.kernel.org, richardcochran@gmail.com,
linux-input@vger.kernel.org, dmitry.torokhov@gmail.com,
zackr@vmware.com, linux-graphics-maintainer@vmware.com,
pv-drivers@vmware.com, namit@vmware.com, timothym@vmware.com,
akaher@vmware.com, jsipek@vmware.com,
dri-devel@lists.freedesktop.org, daniel@ffwll.ch,
airlied@gmail.com, tzimmermann@suse.de, mripard@kernel.org,
maarten.lankhorst@linux.intel.com, horms@kernel.org
Subject: Re: [PATCH v3 2/6] x86/vmware: Introduce vmware_hypercall API
Date: Tue, 19 Dec 2023 19:30:00 -0800 [thread overview]
Message-ID: <e6a4d942-0711-4035-840b-9b2b116ae70c@broadcom.com> (raw)
In-Reply-To: <20231220005156.2rymnxu5bv6wdwlx@box.shutemov.name>
On 12/19/23 4:51 PM, kirill.shutemov@linux.intel.com wrote:
> On Tue, Dec 19, 2023 at 04:17:40PM -0800, Alexey Makhalov wrote:
>>
>>
>> On 12/19/23 3:20 PM, kirill.shutemov@linux.intel.com wrote:
>>> On Tue, Dec 19, 2023 at 01:57:47PM -0800, Alexey Makhalov wrote:
>>>> +static inline
>>>> +unsigned long vmware_hypercall1(unsigned long cmd, unsigned long in1)
>>> ...
>>>> +static inline
>>>> +unsigned long vmware_hypercall3(unsigned long cmd, unsigned long in1,
>>>> + uint32_t *out1, uint32_t *out2)
>>> ...
>>>> +static inline
>>>> +unsigned long vmware_hypercall4(unsigned long cmd, unsigned long in1,
>>>> + uint32_t *out1, uint32_t *out2,
>>>> + uint32_t *out3)
>>> ...
>>>> +static inline
>>>> +unsigned long vmware_hypercall5(unsigned long cmd, unsigned long in1,
>>>> + unsigned long in3, unsigned long in4,
>>>> + unsigned long in5, uint32_t *out2)
>>> ...
>>>> +static inline
>>>> +unsigned long vmware_hypercall6(unsigned long cmd, unsigned long in1,
>>>> + unsigned long in3, uint32_t *out2,
>>>> + uint32_t *out3, uint32_t *out4,
>>>> + uint32_t *out5)
>>> ...
>>>> +static inline
>>>> +unsigned long vmware_hypercall7(unsigned long cmd, unsigned long in1,
>>>> + unsigned long in3, unsigned long in4,
>>>> + unsigned long in5, uint32_t *out1,
>>>> + uint32_t *out2, uint32_t *out3)
>>>
>>> Naming is weird. The number in the name doesn't help much as there seems
>>> no system on how many of the parameters are ins and outs.
>>
>> There was internal discussion on hypercall API naming. One of proposals was
>> using 2 digits - number of input and number of output arguments.
>> And it definitely looked weird. So, we agreed to have just single number -
>> total number of arguments excluding cmd.
>
> Have you considered naming them by number of input parameters? Number of
> output parameters as demanded by users.
>
> So vmware_hypercall4() will become vmware_hypercall1() and current
> vmware_hypercall1() and vmware_hypercall3() will go away.
>
> It is still awful, but /maybe/ better that this, I donno.
>
Deprecating vmware_hypercall1 and vmware_hypercall3 in favor of
vmware_hypercall4 will generate less efficient code for the caller of
first ones.
Using current vmware_hypercall4 instead of vmware_hypercall1 will force
the caller to allocate additional variables (register or on stack
memory) for hypercall asm inline to put additional output registers on.
And specifically to 'usage' of *out3 - compiler will unnecessary
'clobber' useful rdx, when hypervisor will keep it unchanged.
Unfortunately VMware hypercall ABI is not as beautiful as KVM one,
especially in number of output arguments and their ordering. rbp
register usage as an argument is a separate bummer((. So we have to work
with what we have.
Current set of functions includes only 6 functions (for LB), which is
the optimum between readability, maintainability and performance. It
covers all current kernel callers and all new callers from yet to be
upstreamed patches that we have in Photon OS including 2 patches for x86
and arm64 guest support.
Regards,
--Alexey
next prev parent reply other threads:[~2023-12-20 3:30 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-19 21:57 [PATCH v3 0/6] VMware hypercalls enhancements Alexey Makhalov
2023-12-19 21:57 ` [PATCH v3 1/6] x86/vmware: Move common macros to vmware.h Alexey Makhalov
2023-12-19 21:57 ` [PATCH v3 2/6] x86/vmware: Introduce vmware_hypercall API Alexey Makhalov
2023-12-19 23:20 ` kirill.shutemov
2023-12-20 0:17 ` Alexey Makhalov
2023-12-20 0:51 ` kirill.shutemov
2023-12-20 3:30 ` Alexey Makhalov [this message]
2023-12-19 21:57 ` [PATCH v3 3/6] ptp/vmware: Use " Alexey Makhalov
2023-12-19 21:57 ` [PATCH v3 4/6] input/vmmouse: " Alexey Makhalov
2023-12-19 21:57 ` [PATCH v3 5/6] drm/vmwgfx: " Alexey Makhalov
2023-12-19 21:57 ` [PATCH v3 6/6] x86/vmware: Add TDX hypercall support Alexey Makhalov
2023-12-19 23:23 ` kirill.shutemov
2023-12-20 0:27 ` Alexey Makhalov
2023-12-20 1:00 ` kirill.shutemov
2023-12-20 3:02 ` Alexey Makhalov
2023-12-20 13:09 ` kernel test robot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e6a4d942-0711-4035-840b-9b2b116ae70c@broadcom.com \
--to=alexey.makhalov@broadcom.com \
--cc=airlied@gmail.com \
--cc=akaher@vmware.com \
--cc=bp@alien8.de \
--cc=daniel@ffwll.ch \
--cc=dave.hansen@linux.intel.com \
--cc=dmitry.torokhov@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=horms@kernel.org \
--cc=hpa@zytor.com \
--cc=jsipek@vmware.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-graphics-maintainer@vmware.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mingo@redhat.com \
--cc=mripard@kernel.org \
--cc=namit@vmware.com \
--cc=netdev@vger.kernel.org \
--cc=pv-drivers@vmware.com \
--cc=richardcochran@gmail.com \
--cc=tglx@linutronix.de \
--cc=timothym@vmware.com \
--cc=tzimmermann@suse.de \
--cc=virtualization@lists.linux.dev \
--cc=x86@kernel.org \
--cc=zackr@vmware.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox