Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp532457rdh; Sun, 24 Sep 2023 00:16:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFAj1wexUzoUmq/pb9zyJIdcdB02afV9M796riWoA1oYRhP2nNtF0AEkPyttnMyj0WuIWaV X-Received: by 2002:a05:6870:c691:b0:1b0:b13:c16 with SMTP id cv17-20020a056870c69100b001b00b130c16mr5080900oab.2.1695539779599; Sun, 24 Sep 2023 00:16:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695539779; cv=none; d=google.com; s=arc-20160816; b=CfSN4imVVh8tfAwzU3lEwubDj9J54ETx9rM0O+cM4VP2LInsOtkqVbGVxIuqov1CQk L/LHX6gTaoUNCVOsh46AstXNGJKZwGtdq7QljENZBb3pgLJlfEanxX5LGclo5okglaay znBR+aRuqVUnwmsM1IsH6pfbHTI+1MA7QyT/6BhdML9mIpAoN4+A056K9Zr9OKo8t+Ik Im9sGyMtv9YCeb7QMC9zKE2dcWgWrIdHVOiDt+c1u/Cn1bSa+AsrWMaur2chxh1XkDMI AjIPeHztir2ejz8Vr4hvRKfMnraB/YbNzEa4+LfBzM3Rcdqr5xW/2KXbJEhDwyPogfb+ cFSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-filter; bh=ycdXSwymT+4UmVHxCWgMAhINq6kUwu+Xv1H+CeeYOLo=; fh=90Y/q0FNSXNAMN3+OumhTC8ksz+sUEaxGIFAu6HE8Vw=; b=TC1UGb+gcExx1h+34xAJ+Wt8LAMU1sp5OrWRStnzYsmrzQfyp4Ukw1HcUt3/YVVSU0 Gx2muLRoYVy7PlID3ILUivgGaj3ZRmBPxR7gsfLR7YEFHmcazcriYJo3iuP8/37fVZqL OA8dxTV/CQO3xYvbfPO9griC2b0YAm5lZe9PUqv+wujnsHKBcyxMzznsnVzCsSX3nyOy 5HWDpgIn7J/RovkF9JD2lwf9OtMIM2/FbyiRTEIXXgoANuwcS90vFsI5Z2mEZX4bSoqX j6NxTsfK2mwAVSK8i+EF8FdtpFyVrWfUbQpfHLwNlkHBmGF6ZppziVTCrx/j74bAPXCt Cc6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=Hrul3pMr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id 36-20020a631564000000b00573fef93a87si7219914pgv.834.2023.09.24.00.16.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Sep 2023 00:16:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.microsoft.com header.s=default header.b=Hrul3pMr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.microsoft.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 8FF9881552CA; Sat, 23 Sep 2023 21:49:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229904AbjIXEtA (ORCPT + 99 others); Sun, 24 Sep 2023 00:49:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229782AbjIXEsz (ORCPT ); Sun, 24 Sep 2023 00:48:55 -0400 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id BEC01127; Sat, 23 Sep 2023 21:48:48 -0700 (PDT) Received: by linux.microsoft.com (Postfix, from userid 1127) id B9DCC212C7EF; Sat, 23 Sep 2023 21:48:47 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B9DCC212C7EF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1695530927; bh=ycdXSwymT+4UmVHxCWgMAhINq6kUwu+Xv1H+CeeYOLo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Hrul3pMrxBJndXzEFkHYh9mydeunHWFlPfGkKSERsWSDnbH+BAzx5yyNkVU/bdh07 ylJxwm2Yy1U6fwlNVPP9Pmj7kwfjQ8t4/zA/430tW1DiTX4yiaznGs6YSbXtsHmd+w Gs03oZNEijfP929dG/c1EZvK1e+5MdwHS4ErPARg= Date: Sat, 23 Sep 2023 21:48:47 -0700 From: Saurabh Singh Sengar To: Wei Liu Cc: Greg KH , Nuno Das Neves , linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org, patches@lists.linux.dev, mikelley@microsoft.com, kys@microsoft.com, haiyangz@microsoft.com, decui@microsoft.com, apais@linux.microsoft.com, Tianyu.Lan@microsoft.com, mukeshrathor@microsoft.com, stanislav.kinsburskiy@gmail.com, jinankjain@linux.microsoft.com, vkuznets@redhat.com, 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: Re: [PATCH v3 15/15] Drivers: hv: Add modules to expose /dev/mshv to VMMs running on Hyper-V Message-ID: <20230924044847.GA14276@linuxonhyperv3.guj3yctzbm1etfxqx2vob5hsef.xx.internal.cloudapp.net> References: <1695407915-12216-1-git-send-email-nunodasneves@linux.microsoft.com> <1695407915-12216-16-git-send-email-nunodasneves@linux.microsoft.com> <2023092318-starter-pointing-9388@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Sat, 23 Sep 2023 21:49:29 -0700 (PDT) On Sat, Sep 23, 2023 at 08:58:00PM +0000, Wei Liu wrote: > Greg, thank you for looking at the code. > > On Sat, Sep 23, 2023 at 09:56:13AM +0200, Greg KH wrote: > > On Fri, Sep 22, 2023 at 11:38:35AM -0700, Nuno Das Neves wrote: > > > +static int __init mshv_vtl_init(void) > > > +{ > > > + int ret; > > > + > > > + tasklet_init(&msg_dpc, mshv_vtl_sint_on_msg_dpc, 0); > > > + init_waitqueue_head(&fd_wait_queue); > > > + > > > + if (mshv_vtl_get_vsm_regs()) { > > > + pr_emerg("%s: Unable to get VSM capabilities !!\n", __func__); > > > + BUG(); > > > + } > > > > > > So you crash the whole kernel if someone loads this module on a non-mshv > > system? > > > > That seems quite excessive and hostile :( > > > > I agree this can be more lenient. It should be safe to just return an > error code (ENODEV) and let user space decide the next action. > > Saurabh, let me know what you think. Thanks for reporting this. I agree, returning an error makes more sense here. We should do this for both BUG() in this init. - Saurabh > > Thanks, > Wei. > > > Or am I somehow reading this incorrectly? > > > > thanks, > > > > greg k-h > >