Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp420455pxm; Wed, 2 Mar 2022 00:54:48 -0800 (PST) X-Google-Smtp-Source: ABdhPJxa5Eqbu5r6qN9N9oOx2naFv4YZm5qbFLhuRY6BIWs2Ns1pUJVpUD1FL7PCu5oihekKteG2 X-Received: by 2002:a17:906:d8d2:b0:6cf:6273:9c37 with SMTP id re18-20020a170906d8d200b006cf62739c37mr23151805ejb.727.1646211287831; Wed, 02 Mar 2022 00:54:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646211287; cv=none; d=google.com; s=arc-20160816; b=WjIRyWCKc+SQEURcUBXeuw+xY4qV4d0MtEWQzVxMdyfNIZjTQ6c+/IJu17SYv7SiL4 rRJ5gSRrZrLVcMoPFbDBWjpSzmiWOe7exWvhrNyZ0q1EV1EgI3LIeCm+uLeXZ3s7dD1l dLcNQCaUwTZqTPNJSX90J7MXEZto+ouXeBGmZ7xJJ5TqWbf1FLWKDlX8YKQtNe1ALoiG WpIzDImkqLmEwAVGXOQsRZ7MRt05oXFHg3f1q19It6DCSMkCdqkojfHJOTV8bVdDPxga YXqqyW+im/mwkZ3DBXyZzoeZQ898hW9AKu4Y+V8WRUjRxDW42DH+5osUU7MAghhkFR3S ez4g== 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=qmLB0MmP9uqP6RXGIR5raG+mUMpoENIoAsqy7EycV20=; b=VdJJ8fdQhuiy5Cks2u6eq9bBGVe9sYtmrok7k6sGtST3Q4KE3WlgSIdLXpTKcOmwZj 54FyOy2t7o3GREed0OuRYs7U8OlE8TfccwmnmGrhP71Mzwxk/UcftGzeuem75YllkjZP VW4LxrMXGbdEnLPOjIHF2VZoa062e9+KbRRadBhL0Gl/2T4dk+i4zqG9py3J8Kfuu3jg k2eiyO6ZFFJIFGOcrl//bn9sYcJZFjJtrf138dUEU3N7a4Zrad5yHt7s9M0PlhGQCK4O 0MI0+F+kLOkp4FySS2V80ixiqw4JbvGoKKBpTOm9Zq1iqDTO33btes69xoiSQ8FYtDJx bFyw== 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 j20-20020a170906411400b006cf1189c55dsi9337651ejk.219.2022.03.02.00.54.25; Wed, 02 Mar 2022 00:54:47 -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 S238710AbiCAXsb (ORCPT + 99 others); Tue, 1 Mar 2022 18:48:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58654 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235135AbiCAXsa (ORCPT ); Tue, 1 Mar 2022 18:48:30 -0500 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDC453669E; Tue, 1 Mar 2022 15:47:47 -0800 (PST) Received: by mail-wm1-f49.google.com with SMTP id i66so102204wma.5; Tue, 01 Mar 2022 15:47:47 -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=qmLB0MmP9uqP6RXGIR5raG+mUMpoENIoAsqy7EycV20=; b=ZipqvlJcROUMsZmurkm/of87fVRKk9ggzN9iBn+Y48P6VlcLTCuGrLXLgJOZE0iNSI 9UxcTysSENXy1p0C6pMzrUjFMKwiwAkavHAxiPFUHqVqbQsjWRisAPicMNNuKAk15OoS Gy+GoXOz34eBrX6HwahE7m2zjR8i87y0cNUVhuwieAKXI/w+4WOEBpMoGDMGuc2n8c67 oGzxP63GumYKGBRl4fei4jvg1v0s13tShnsacNKeIRLud4Fsa6DQnIuL0BAm2sEHrdYd C0DhHV1LTgysdgpbkJ0BKnZ2Qjj7YHzrmSbeYqTuIdMR/QuV5NDVXj4gD43x4Z62FytT xKlg== X-Gm-Message-State: AOAM532CcJFsJAq1JQultHDRVBqrwyzB0a+vEZC86j3KMF8BxBMN4ac0 RKVpBxSf8vOMi2fLrFMm6LY= X-Received: by 2002:a1c:1905:0:b0:34f:477e:8850 with SMTP id 5-20020a1c1905000000b0034f477e8850mr18719625wmz.131.1646178466554; Tue, 01 Mar 2022 15:47:46 -0800 (PST) Received: from liuwe-devbox-debian-v2 ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id f9-20020adffcc9000000b001e9e8163a46sm21199976wrs.54.2022.03.01.15.47.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Mar 2022 15:47:46 -0800 (PST) Date: Tue, 1 Mar 2022 23:47:44 +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 05/30] drivers: hv: dxgkrnl: Opening of /dev/dxg device and dxgprocess creation Message-ID: <20220301234744.plggauzg4ka5p3tm@liuwe-devbox-debian-v2> References: <719fe06b7cbe9ac12fa4a729e810e3383ab421c1.1646163378.git.iourit@linux.microsoft.com> <419b863b2848b9e86382511a2f0f12cf91065578.1646163378.git.iourit@linux.microsoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <419b863b2848b9e86382511a2f0f12cf91065578.1646163378.git.iourit@linux.microsoft.com> 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:52AM -0800, Iouri Tarassov wrote: > - Implement opening of the device (/dev/dxg) file object and creation of > dxgprocess objects. [...] > static int dxgk_open(struct inode *n, struct file *f) > { > - return 0; > + int ret = 0; > + struct dxgprocess *process; > + > + pr_debug("%s %p %d %d", > + __func__, f, current->pid, current->tgid); > + > + > + /* Find/create a dxgprocess structure for this process */ > + process = dxgglobal_get_current_process(); > + > + if (process) { > + f->private_data = process; > + } else { > + pr_debug("cannot create dxgprocess for open\n"); > + ret = -EBADF; > + } > + > + pr_debug("%s end %x", __func__, ret); I would normally remove pr_deubg's like this when submitting. It doesn't provide much information. > + return ret; > } > [...] > > +int dxgvmb_send_create_process(struct dxgprocess *process) > +{ > + int ret; > + struct dxgkvmb_command_createprocess *command; > + struct dxgkvmb_command_createprocess_return result = { 0 }; > + struct dxgvmbusmsg msg; > + char s[WIN_MAX_PATH]; > + int i; > + > + ret = init_message(&msg, NULL, process, sizeof(*command)); > + if (ret) > + return ret; > + command = (void *)msg.msg; > + > + ret = dxgglobal_acquire_channel_lock(); > + if (ret < 0) > + goto cleanup; > + > + command_vm_to_host_init1(&command->hdr, DXGK_VMBCOMMAND_CREATEPROCESS); > + command->process = process; > + command->process_id = process->process->pid; > + command->linux_process = 1; > + s[0] = 0; > + __get_task_comm(s, WIN_MAX_PATH, process->process); > + for (i = 0; i < WIN_MAX_PATH; i++) { > + command->process_name[i] = s[i]; > + if (s[i] == 0) > + break; > + } What's wrong with doing __get_task_comm(command->process_name, WIN_MAX_PATH, process->process); here? That saves you many bytes on stack. [...] > +static char *errorstr(int ret) > +{ > + return ret < 0 ? "err" : ""; > +} > + This is not used in this patch. [...] > diff --git a/drivers/hv/dxgkrnl/misc.h b/drivers/hv/dxgkrnl/misc.h > index 1ff0c0e28332..433b59d3eb23 100644 > --- a/drivers/hv/dxgkrnl/misc.h > +++ b/drivers/hv/dxgkrnl/misc.h > @@ -31,7 +31,6 @@ extern const struct d3dkmthandle zerohandle; > * table_lock > * core_lock > * device_lock > - * process->process_mutex Why is this deleted? Thanks, Wei.