Received: by 2002:a05:6358:111d:b0:dc:6189:e246 with SMTP id f29csp987446rwi; Wed, 2 Nov 2022 22:34:13 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4B3ni01ilgoNXwSqC8SHhhopNjUDjVBR/LrbERU4qumX1vqVfcS+OVhixng/8pBkiLHPQ9 X-Received: by 2002:a17:907:980e:b0:78d:b6ea:25b3 with SMTP id ji14-20020a170907980e00b0078db6ea25b3mr26746929ejc.98.1667453653274; Wed, 02 Nov 2022 22:34:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667453653; cv=none; d=google.com; s=arc-20160816; b=A68x9Vsse/Em3QJyKnihrTAUTU2RhMG0of49Xst8jVDOQGVn/c+INeb1TtdInizxvH 3TOQBJG2xRjUia/7dHn2c/89Uzn5kFcw+3JkTxW9DjFIMMntQxSrtGBFievqdKr15VcL DJNYAb7DNZZel4S4VXTqZi9AZu2vRsI2ZWtffAgV80PwK9b7rgwndkRECqdz/uMbbI/4 9MfIS4kjYdniqoBtxcRvq5D2+djSCDtmkN/kKLMTdmnKVr3fWub4qvy91UTD/rGM9VJW e6r0drSPGSt5mqUv/7O6cH3hOWvQ4YEh0jU7znZUBB8zttoMM/9kzIEAEk7vKt7aQeD9 AWLg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:dlp-filter:cms-type :content-transfer-encoding:mime-version:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature:dkim-filter; bh=N6OstaZqGaKmMYklgkBVwBadufwTTLXmst0xPYUQmRQ=; b=mIbw5k3jvW3jNncIPmNK7xYEiXXJa60egDKwnRdyDx4AiNomAp8w1UcXCxVoxb2J7t eozwX92DkrtkHDeSjAZIF+4h4NmELL1Pc0h8j9BDbxVZrpF98nR/fE2UVTjwjnjVxVlg FZ9tRlrzy2+qW2bqJowO+BePXEvvltL9+3mxb/HbtNM5F4A7W9vnLPdQjeam84IeBwvr 8GEExUPXYHxIbgDhCqKjBzzaQamtBjnZBKOc1MY4smSlTHVMlcpzCxfU6zJ94yua7zMd xxtYzqnRmSneWdQfacyjTZ+ypqdHUMQOHc8Ni0C55ygTNpGZ0EaRTVf6B3udaxdgJgOD EyhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=LnFdmrYX; 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=samsung.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m17-20020a50c191000000b00463153e5b14si13325edf.517.2022.11.02.22.33.49; Wed, 02 Nov 2022 22:34:13 -0700 (PDT) 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; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=LnFdmrYX; 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=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230094AbiKCF0D (ORCPT + 98 others); Thu, 3 Nov 2022 01:26:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229643AbiKCF0B (ORCPT ); Thu, 3 Nov 2022 01:26:01 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0294717072 for ; Wed, 2 Nov 2022 22:26:00 -0700 (PDT) Received: from epcas1p1.samsung.com (unknown [182.195.41.45]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20221103052557epoutp03159a65d720137f0349fc3cad230fe8f9~j_8-1Y7cP0947909479epoutp03k for ; Thu, 3 Nov 2022 05:25:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20221103052557epoutp03159a65d720137f0349fc3cad230fe8f9~j_8-1Y7cP0947909479epoutp03k DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1667453157; bh=N6OstaZqGaKmMYklgkBVwBadufwTTLXmst0xPYUQmRQ=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=LnFdmrYXrgOeJSDmDs8SUoNfEdSigJ5Dp762TyfyMHrNoNyJIwxLi2GMEAVeKif1X z6GL6Jz/F5w2x0qLo2BYcaHbABHXnA0UWM1eGJjLo6WzmZLEPgNdp+koBlbxb1E18h SEcZ/IomMpbkVy7Eou7OLQToNCJ2Gug68XfVnsC4= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20221103052556epcas1p4323dee8ef7c89549b1b606cc53bed32e~j_8-IY2ln1028810288epcas1p4M; Thu, 3 Nov 2022 05:25:56 +0000 (GMT) Received: from epsmges1p5.samsung.com (unknown [182.195.38.237]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4N2sfq6KqGz4x9Q7; Thu, 3 Nov 2022 05:25:55 +0000 (GMT) Received: from epcas1p3.samsung.com ( [182.195.41.47]) by epsmges1p5.samsung.com (Symantec Messaging Gateway) with SMTP id CF.CB.20046.3E053636; Thu, 3 Nov 2022 14:25:55 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas1p2.samsung.com (KnoxPortal) with ESMTPA id 20221103052555epcas1p24b9f02c98b83fdc805b5817b85df7f80~j_89vaMyY0582505825epcas1p2i; Thu, 3 Nov 2022 05:25:55 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20221103052555epsmtrp209076225c95c094cee9e5c2916c56cd6~j_89tm__e1917019170epsmtrp2I; Thu, 3 Nov 2022 05:25:55 +0000 (GMT) X-AuditID: b6c32a39-35fff70000004e4e-81-636350e382b3 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 6A.48.18644.3E053636; Thu, 3 Nov 2022 14:25:55 +0900 (KST) Received: from jiho-chu04.tn.corp.samsungelectronics.net (unknown [10.113.112.236]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20221103052555epsmtip1feef47f5f5417d27bbc7655435bc939d~j_89af4Q23156231562epsmtip1Z; Thu, 3 Nov 2022 05:25:55 +0000 (GMT) Date: Thu, 3 Nov 2022 14:25:54 +0900 From: Jiho Chu To: Oded Gabbay Cc: David Airlie , Daniel Vetter , Arnd Bergmann , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jason Gunthorpe , John Hubbard , Alex Deucher , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Yuji Ishikawa , Daniel Stone , Tvrtko Ursulin , Jeffrey Hugo , Christoph Hellwig , Kevin Hilman , Jagan Teki , Jacek Lawrynowicz , Maciej Kwapulinski Subject: Re: [RFC PATCH v2 2/3] accel: add dedicated minor for accelerator devices Message-Id: <20221103142554.6310a60f0f6dad1a59fa7644@samsung.com> In-Reply-To: <20221102203405.1797491-3-ogabbay@kernel.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA02Te0xTdxTH/fW2t62z5FpQfnZLKHeQTTaghZb9YEBE0NyEZcPA/GOLYV17 Ax3Qdm3ZlG3yGspz8hZ5OJ4WWMFQkafoBigiaGASZAnIkrlhDG8GIgxdy8W5/77n/D7nnN85 J4eHCTO5Ip5aY6T1GkUsie9mt/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O PD21jfNOe90DqdY6JwbGHIa+Ois90yMKS5IWtvHMXfor7kMl38wy3js/HrP0zfdMemH27FvG vbOpEg97jxR+TNdQ9he7Nv1szmtOlV1GojJGk9xzJuddZ/dytdzlW1JroBmfdpLxSkd2+lsB f35XgX7uT5pNNybvzozxDtRduaQ57bC5TguHUM2u/e586ntORc7dkzCFVYrLX1or83V/3F4h rbPn5eer+viXVNQxMj3q4cyfnNwfkKDEUpyRaKjFXFScCABNxAygcgMAAA== X-CMS-MailID: 20221103052555epcas1p24b9f02c98b83fdc805b5817b85df7f80 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20221102203430epcas1p380845d7a6ebc38ab1f41acf8c48a4480 References: <20221102203405.1797491-1-ogabbay@kernel.org> <20221102203405.1797491-3-ogabbay@kernel.org> X-Spam-Status: No, score=-5.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, 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 On Wed, 2 Nov 2022 22:34:04 +0200 Oded Gabbay wrote: > +/** > + * accel_open - open method for ACCEL file > + * @inode: device inode > + * @filp: file pointer. > + * > + * This function must be used by drivers as their &file_operations.open method. > + * It looks up the correct ACCEL device and instantiates all the per-file > + * resources for it. It also calls the &drm_driver.open driver callback. > + * > + * Return: 0 on success or negative errno value on failure. > + */ > +int accel_open(struct inode *inode, struct file *filp) > +{ > + struct drm_device *dev; > + struct drm_minor *minor; > + int retcode; > + > + minor = accel_minor_acquire(iminor(inode)); > + if (IS_ERR(minor)) > + return PTR_ERR(minor); > + > + dev = minor->dev; > + > + atomic_fetch_inc(&dev->open_count); > + Hi, It needs to consider drm_global_mutex to access open_count. please check doxy of open_count. > + /* share address_space across all char-devs of a single device */ > + filp->f_mapping = dev->anon_inode->i_mapping; > + > + retcode = drm_open_helper(filp, minor); > + if (retcode) > + goto err_undo; > + > + return 0; > + > +err_undo: > + atomic_dec(&dev->open_count); > + accel_minor_release(minor); > + return retcode; > +} > +EXPORT_SYMBOL_GPL(accel_open); > + > static int accel_stub_open(struct inode *inode, struct file *filp) > { > - DRM_DEBUG("Operation not supported"); > + const struct file_operations *new_fops; > + struct drm_minor *minor; > + int err; > + > + DRM_DEBUG("\n"); It seems useless. Thanks. Jiho Chu