Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp191528pxm; Wed, 2 Mar 2022 13:12:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJxr3/+ui95AnBgDLyOMghmqkUg03FOy1veWg5CmvOhmdLp87TOkNeG/AtH4DRYtvqAyFUaU X-Received: by 2002:a17:906:ae56:b0:6ce:375a:4b93 with SMTP id lf22-20020a170906ae5600b006ce375a4b93mr25273056ejb.189.1646255541826; Wed, 02 Mar 2022 13:12:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646255541; cv=none; d=google.com; s=arc-20160816; b=sapHATwCbF3ohA9zg9ps5md9y9NzK3I55FPx/FoIoCx7+VadKs8GWRWUSdbi6XmXKE UXOGyoTNLqPl1Wg1lDZIe1csSkNwGWeKwH4HDv0GRq/Fa0oUuDqJJGF0d2sHIyoGhWyO kgkc2qmzC7RAtvItbqz5tdJdccb62GtQO2PdX0Kvtg8KfNfRA1GRQuCI5PZ4U/Dmd3uJ cWohoOKeGlQE5q4lNdDuPWzEg3wA0p6GNwduK2LKqLdvnrlxrf67kDO2bLQsMVx/rORK QXlSojOguyXKzyTJjD77jeUSzlcE0IMzHZL/Fns9ZrLuG5lQzAYgEF7gGre+4LV9XbiI VRwQ== 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; bh=ihKhXy8qF1g/GS0RQKaO6pmBjBYQT9XtmSR0oNtogaU=; b=qz7dcRTwb+Qtj4DloSb4Bo5tH0QZX4r9KGZ8MN07+33dFIGs5aPRrZYPljK/EaPm/F 1aKz4TgAUKml2nBsleX/asJ6TrHMHceZoTMu3xk1xVDMvmbO88vRqAhEJwrJCzrM9VKN +ZqblpFqSQA/5BgaP+OpDCtXsgRLOXkswX/xHraUhrmkevFvAn5s3iBXgRm1SbOjKIus eCzcArua0h1wnC99gl90IDeR7SXrj7onBMVeKpMf8N742a+Prh1to3aJH92bahKNdqol TSo16ES7Y+YssphRFjlqU+cLhSfkBcBaY1LITn+Mi+K8bVFNYk7kqnBkejxFOs9avjSV HbPg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s18-20020a170906501200b006ce8c194831si76349ejj.904.2022.03.02.13.11.58; Wed, 02 Mar 2022 13:12:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233179AbiCBMn5 (ORCPT + 99 others); Wed, 2 Mar 2022 07:43:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49748 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229967AbiCBMn4 (ORCPT ); Wed, 2 Mar 2022 07:43:56 -0500 Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D683B74DC5; Wed, 2 Mar 2022 04:43:12 -0800 (PST) Received: by mail-wr1-f51.google.com with SMTP id m6so2571396wrr.10; Wed, 02 Mar 2022 04:43:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ihKhXy8qF1g/GS0RQKaO6pmBjBYQT9XtmSR0oNtogaU=; b=mSN3js/IoF9cuyr7aF+reJcxk2m3CKjqTkrtwWuCFVs0+XPaTSDcPz0uA9upp51dix C6FRO+ioSwFdyNdHOobwCbT1jBEhkgF1KFPzDBc30siScSlEJNTDBdsKBdVcZbKDz+NB c1qsOfUsTc/YCmIMvri5Qa1/oWuucujsLHOpORptGE4zCRrHeSsgr4ykN3+LFTj9gZ1b 3uDpA0SfnRTeldZFbPPHLHSVY/Dm26bvXSWMIqgl1818StvY36OnsfC932FtoHeSuhnX e1FJbx3fcDkdOpKgKlScy5xJJef4UTZZecI3c3ROMEENqEmUZOTfGgBaLOCPA6KIaHvK t9iA== X-Gm-Message-State: AOAM532oRNj7sz6g/727P+Jx/aeTem/q0GgpFDrfpat0nWW2Ro7rTwuQ FqbdXoY2QWQQ33v+aHrqLQ4= X-Received: by 2002:a5d:5746:0:b0:1ea:9643:92ac with SMTP id q6-20020a5d5746000000b001ea964392acmr22528679wrw.597.1646224991395; Wed, 02 Mar 2022 04:43:11 -0800 (PST) Received: from liuwe-devbox-debian-v2 ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id i15-20020a05600011cf00b001edc2966dd4sm16337747wrx.47.2022.03.02.04.43.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 04:43:10 -0800 (PST) Date: Wed, 2 Mar 2022 12:43:09 +0000 From: Wei Liu To: Iouri Tarassov Cc: kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, wei.liu@kernel.org, linux-hyperv@vger.kernel.org, linux-kernel@vger.kernel.org, spronovo@microsoft.com, spronovo@linux.microsoft.com, gregkh@linuxfoundation.org Subject: Re: [PATCH v3 06/30] drivers: hv: dxgkrnl: Enumerate and open dxgadapter objects Message-ID: <20220302124309.w2zkzfaq3oinok3g@liuwe-devbox-debian-v2> References: <719fe06b7cbe9ac12fa4a729e810e3383ab421c1.1646163378.git.iourit@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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 On Tue, Mar 01, 2022 at 11:45:53AM -0800, Iouri Tarassov wrote: [...] > +void dxgadapter_remove_process(struct dxgprocess_adapter *process_info) > +{ > + pr_debug("%s %p %p", __func__, > + process_info->adapter, process_info); This is not very useful in a production system. Keep in mind that this can flood dmesg when the debug level is cranked up. The user is just perhaps trying to get information for other parts of the kernel. I would like to ask you to reduce the amount of pr_debug's in code, only leave the most critical ones in place. There is ftrace and ebfp in the kernel to help with observation at runtime. > + list_del(&process_info->adapter_process_list_entry); > + process_info->adapter_process_list_entry.next = NULL; > + process_info->adapter_process_list_entry.prev = NULL; There is no need to explicitly set next and prev pointers to NULL. They have been set to poison values by list_del. Please remove this kind of code from all other places. > +} > + > int dxgadapter_acquire_lock_exclusive(struct dxgadapter *adapter) > { > down_write(&adapter->core_lock); > @@ -170,3 +198,52 @@ void dxgadapter_release_lock_shared(struct dxgadapter *adapter) > { > up_read(&adapter->core_lock); > } > + [...] > +struct dxgprocess_adapter *dxgprocess_get_adapter_info(struct dxgprocess > + *process, > + struct dxgadapter > + *adapter) Please document the locking requirement or renamed this function. I see the list is manipulated with no lock held. > +{ > + struct dxgprocess_adapter *entry; > + > + list_for_each_entry(entry, &process->process_adapter_list_head, > + process_adapter_list_entry) { > + if (adapter == entry->adapter) { > + pr_debug("Found process info %p", entry); > + return entry; > + } > + } > + return NULL; > +} Thanks, Wei.