From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5498DEE49AB for ; Tue, 22 Aug 2023 21:00:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=e2MEi9l5ObCQDRo/L4nExIdSWC8BC+TB3OydjE3fJoY=; b=GFta3XA/zBTF0e 8dxsD0VSUIw0I7K6Wb8Q50ZwvSg6VokNWvfT3m11gYWPG3VEPAeaMWPG74TPlptlxfQmhiVv6b5bk iblj2Sm9oFxVMM6ar2H7wsTVqsC9Mt5I+5qeNZWSHl+aQEOknH0lX4CZxX1LYTAUsdAT7UgOzDJy7 TYMLEI3q66AqEcvGCgxgukleb/yz11y/X+hqxlqMGPX++7VMYQr+AQR/FvdrgKC13Bp87o032nEbq BHSgLRGocanK1v3sq/OnaI5seE1rmKkS+UK4MCr8Az+2HWAcHjS/vcWGdlcCzDLKeyeRVE8xPvkl/ 8h5Uljlt4SnCVcSGjHow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qYYTv-00GnMT-2X; Tue, 22 Aug 2023 21:00:07 +0000 Received: from linux.microsoft.com ([13.77.154.182]) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qYYTt-00GnLT-1V for linux-arm-kernel@lists.infradead.org; Tue, 22 Aug 2023 21:00:06 +0000 Received: from [192.168.0.5] (71-212-112-68.tukw.qwest.net [71.212.112.68]) by linux.microsoft.com (Postfix) with ESMTPSA id 6E15F2126CD1; Tue, 22 Aug 2023 14:00:01 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 6E15F2126CD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1692738001; bh=Wik2nYlgFy2h1vwJvpE3BbkkhoxbzmyA5NHLHlPVd2g=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Z/J45Xowxo29xY/xCJi1OztlNqr4L62uk0uJjhJWK4PJzqvW/0uXbhZf+d5fywsGH nOWnLmddSQJ3gTJiBRWuTuimYwrk/fjCu9d3kFnz1ucTJUSNR0ztdQW7W6I6mAUb3R 4TRYyaYL/egYfQNi9SS8ROI9g6UVFOxwWsObhWFA= Message-ID: Date: Tue, 22 Aug 2023 14:00:10 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 15/15] Drivers: hv: Add modules to expose /dev/mshv to VMMs running on Hyper-V Content-Language: en-US To: Saurabh Singh Sengar , "linux-hyperv@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "x86@kernel.org" , "linux-arm-kernel@lists.infradead.org" , "linux-arch@vger.kernel.org" Cc: "patches@lists.linux.dev" , "Michael Kelley (LINUX)" , KY Srinivasan , "wei.liu@kernel.org" , Haiyang Zhang , Dexuan Cui , "apais@linux.microsoft.com" , Tianyu Lan , "ssengar@linux.microsoft.com" , MUKESH RATHOR , "stanislav.kinsburskiy@gmail.com" , "jinankjain@linux.microsoft.com" , vkuznets , "tglx@linutronix.de" , "mingo@redhat.com" , "bp@alien8.de" , "dave.hansen@linux.intel.com" , "hpa@zytor.com" , "will@kernel.org" , "catalin.marinas@arm.com" References: <1692309711-5573-1-git-send-email-nunodasneves@linux.microsoft.com> <1692309711-5573-16-git-send-email-nunodasneves@linux.microsoft.com> From: Nuno Das Neves In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230822_140005_576895_039EF35F X-CRM114-Status: GOOD ( 20.00 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 8/21/2023 11:18 AM, Saurabh Singh Sengar wrote: > > >> -----Original Message----- >> From: Nuno Das Neves >> Sent: Friday, August 18, 2023 3:32 AM >> To: linux-hyperv@vger.kernel.org; linux-kernel@vger.kernel.org; >> x86@kernel.org; linux-arm-kernel@lists.infradead.org; linux- >> arch@vger.kernel.org >> Cc: patches@lists.linux.dev; Michael Kelley (LINUX) >> ; KY Srinivasan ; >> wei.liu@kernel.org; Haiyang Zhang ; Dexuan Cui >> ; apais@linux.microsoft.com; Tianyu Lan >> ; ssengar@linux.microsoft.com; MUKESH >> RATHOR ; stanislav.kinsburskiy@gmail.com; >> jinankjain@linux.microsoft.com; vkuznets ; >> tglx@linutronix.de; mingo@redhat.com; bp@alien8.de; >> dave.hansen@linux.intel.com; hpa@zytor.com; will@kernel.org; >> catalin.marinas@arm.com >> Subject: [PATCH v2 15/15] Drivers: hv: Add modules to expose /dev/mshv to >> VMMs running on Hyper-V >> >> Add mshv, mshv_root, and mshv_vtl modules: >> > > > >> + ret = mshv_set_vp_registers(vp->index, vp->partition->id, >> + 1, &dispatch_suspend); >> + if (ret) >> + pr_err("%s: failed to suspend partition %llu vp %u\n", >> + __func__, vp->partition->id, vp->index); >> + >> + return ret; >> +} >> + >> +static int >> +get_vp_signaled_count(struct mshv_vp *vp, u64 *count) >> +{ >> + int ret; >> + struct hv_register_assoc root_signal_count = { >> + .name = HV_REGISTER_VP_ROOT_SIGNAL_COUNT, >> + }; >> + >> + ret = mshv_get_vp_registers(vp->index, vp->partition->id, >> + 1, &root_signal_count); >> + >> + if (ret) { >> + pr_err("%s: failed to get root signal count for partition %llu vp >> %u", >> + __func__, vp->partition->id, vp->index); >> + *count = 0; > > Have we missed a return here ? > Moreover, the return type of this function is never checked consider > checking it or change it to void. > Thanks, we do need to return here. This function is called on a cleanup path (deleting the guest VM), so if it fails something is wrong. Instead of returning void, I think we should check the return value with WARN_ON(), and abort the cleanup if it failed. >> + >> +/* Retrieve and stash the supported scheduler type */ >> +static int __init mshv_retrieve_scheduler_type(void) >> +{ >> + struct hv_input_get_system_property *input; >> + struct hv_output_get_system_property *output; >> + unsigned long flags; >> + u64 status; >> + >> + local_irq_save(flags); >> + input = *this_cpu_ptr(hyperv_pcpu_input_arg); >> + output = *this_cpu_ptr(hyperv_pcpu_output_arg); >> + >> + memset(input, 0, sizeof(*input)); >> + memset(output, 0, sizeof(*output)); >> + input->property_id = HV_SYSTEM_PROPERTY_SCHEDULER_TYPE; >> + >> + status = hv_do_hypercall(HVCALL_GET_SYSTEM_PROPERTY, input, >> output); >> + if (!hv_result_success(status)) { >> + local_irq_restore(flags); >> + pr_err("%s: %s\n", __func__, hv_status_to_string(status)); >> + return hv_status_to_errno(status); >> + } >> + >> + hv_scheduler_type = output->scheduler_type; >> + local_irq_restore(flags); >> + >> + pr_info("mshv: hypervisor using %s\n", >> scheduler_type_to_string(hv_scheduler_type)); > > Nit: In this file we are using two styles of prints, few are appended with > "mshv:" and few with "__func__". It's better to have a single style > for one module. Thanks, I'll switch them all to __func__ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel