Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2402986rdh; Wed, 27 Sep 2023 01:10:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHCqpBpoppIgAPNBbEzubVKF4RyFqXdcsaJ15Dmt1tSdg5aePmAhZnF78tuVlzpiGZWt5GQ X-Received: by 2002:a17:903:238b:b0:1b8:2ba0:c9c0 with SMTP id v11-20020a170903238b00b001b82ba0c9c0mr1089065plh.59.1695802251804; Wed, 27 Sep 2023 01:10:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695802251; cv=none; d=google.com; s=arc-20160816; b=x9Nk7on7/fu2LMeBej8X3kM41bkhCviwc5g/lascsem6xf4kLgHvPBZZi2fVHr51D2 K1582uiRZEJsbQwCdAFNN+bwo8p+B7VLEzKrAeuTu5B6wlyinjDCK+BMbqFKkZCEM4Rb BCYX3qmfjcEpltrs07P03IiKYBBTEb/+Vq49b/2hiEea8y1b/OY1wfJF4g3wSS81INIR YVI1chXCWBJ7ZT22sEiLyDzDNeMuvxB2ZA4yXGYbg5DhrihOcknlCSs9iYU+mU/h2i37 TGOUUtIXf8bL9OAiGoeS1w36oMz1es/GI/PK6tTQlgibcjhnqwYxz/L5/WM4uzUt4JOg B/RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=sxKAqkM9uo0f+teZUDBPZHtnnyK5kt08KSPdOImsDJ8=; fh=CFe6zpE67W5acWuj8rGGbJDtr0s/XuS9f00Z1ivHRYc=; b=HdzhyTbSXLVrKYjB8LouH1bylsbgGISI3oZsyLLG1NFe6ren/sVKjWxZxmwL7I1NzJ 1VNey09/a0AgAp/64oM4cVLK9hrTEZWh/Co+cKSpyE+jt2/aTMdNwOGq/B82hMsWAS6M 32v93pjoxKoI1BSjCZ64tCTzvTnR+Gb14/JueeiTXH9lohYXDabNXWcKWPLsDS6EPWQZ f19DXSP/w15GauQlweMNAsOjKee4Xg8pmtBSyrA3LJjag7Kh6DuVGI8R0/Qq5jrgyEbw Uz6vMoxapjAQHWGUhy33MkF25r+QYbCLI//jAoP9go5y1NAeF0OCkaB7Hp3SaIDwifLn dnHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=j2LRf4pJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id 21-20020a170902ee5500b001c60a0a8d2asi8939622plo.282.2023.09.27.01.10.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 01:10:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=j2LRf4pJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 38D8D8042A9D; Tue, 26 Sep 2023 23:02:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230006AbjI0GCq (ORCPT + 99 others); Wed, 27 Sep 2023 02:02:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229934AbjI0GCO (ORCPT ); Wed, 27 Sep 2023 02:02:14 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A5A9CDB; Tue, 26 Sep 2023 23:01:04 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AD420C433C7; Wed, 27 Sep 2023 06:01:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1695794464; bh=5bU3gzx6D/KCU0/C5mz2JXiNA41aaEP8U6oXybPm8gI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=j2LRf4pJ6rPQn6ySzyf20SC7ew+5hiHg0ZgTGztrtSHsf+ONc0fSbPWBjlR9BQEcF T9u0I6IHdfCXvEtS+qRFuUJFBEdCb9gUa1iDa3NEL90zruzcMkXboJd04FQft3n+wA JDYbRNptapF/6wySxZlqHvmS2oV11NdlYt4NoVdQ= Date: Wed, 27 Sep 2023 08:01:01 +0200 From: Greg KH To: Nuno Das Neves Cc: Wei Liu , 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, ssengar@linux.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: <2023092737-daily-humility-f01c@gregkh> References: <1695407915-12216-1-git-send-email-nunodasneves@linux.microsoft.com> <1695407915-12216-16-git-send-email-nunodasneves@linux.microsoft.com> <2023092342-staunch-chafe-1598@gregkh> <2023092630-masculine-clinic-19b6@gregkh> <2023092614-tummy-dwelling-7063@gregkh> <2023092646-version-series-a7b5@gregkh> <05119cbc-155d-47c5-ab21-e6a08eba5dc4@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <05119cbc-155d-47c5-ab21-e6a08eba5dc4@linux.microsoft.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (howler.vger.email [0.0.0.0]); Tue, 26 Sep 2023 23:02:50 -0700 (PDT) On Tue, Sep 26, 2023 at 02:52:36PM -0700, Nuno Das Neves wrote: > On 9/26/2023 1:03 AM, Greg KH wrote: > > On Tue, Sep 26, 2023 at 07:00:51AM +0000, Wei Liu wrote: > > > On Tue, Sep 26, 2023 at 08:31:03AM +0200, Greg KH wrote: > > > > On Tue, Sep 26, 2023 at 05:54:34AM +0000, Wei Liu wrote: > > > > > On Tue, Sep 26, 2023 at 06:52:46AM +0200, Greg KH wrote: > > > > > > On Mon, Sep 25, 2023 at 05:07:24PM -0700, Nuno Das Neves wrote: > > > > > > > On 9/23/2023 12:58 AM, Greg KH wrote: > > > > > > > > Also, drivers should never call pr_*() calls, always use the proper > > > > > > > > dev_*() calls instead. > > > > > > > > > > > > > > > > > > > > > > We only use struct device in one place in this driver, I think that is the > > > > > > > only place it makes sense to use dev_*() over pr_*() calls. > > > > > > > > > > > > Then the driver needs to be fixed to use struct device properly so that > > > > > > you do have access to it when you want to print messages. That's a > > > > > > valid reason to pass around your device structure when needed. > > > > > > > What is the tangible benefit of using dev_*() over pr_*()? Unified reporting and handling of userspace of kernel log messages so they can be classified properly as well as dealing correctly with the dynamic debugging kernel infrastructure. Why wouldn't you want to use it? > As I said, > our use of struct device is very limited compared to all the places we > may need to log errors. Then please fix that. > pr_*() is used by many, many drivers; it seems to be the norm. Not at all, it is not. > We can certainly add a pr_fmt to improve the logging. Please do it correctly so you don't have to go and add support for it later when your tools people ask you why they can't properly parse your driver's kernel log messages. > > > If we're working with real devices like network cards or graphics cards > > > I would agree -- it is easy to imagine that we have several cards of the > > > same model in the system -- but in real world there won't be two > > > hypervisor instances running on the same hardware. > > > > > > We can stash the struct device inside some private data fields, but that > > > doesn't change the fact that we're still having one instance of the > > > structure. Is this what you want? Or do you have something else in mind? > > > > You have a real device, it's how userspace interacts with your > > subsystem. Please use that, it is dynamically created and handled and > > is the correct representation here. > > > > Are you referring to the struct device we get from calling > misc_register? Yes. > How would you suggest we get a reference to that device via e.g. open() > or ioctl() without keeping a global reference to it? You explicitly have it in your open() and ioctl() call, you never need a global reference for it the kernel gives it to you! thanks, greg k-h