From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D550C00A89 for ; Thu, 5 Nov 2020 11:16:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 80F5D20759 for ; Thu, 5 Nov 2020 11:16:48 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="R0t4CKpy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730068AbgKELQr (ORCPT ); Thu, 5 Nov 2020 06:16:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726067AbgKELQr (ORCPT ); Thu, 5 Nov 2020 06:16:47 -0500 Received: from mail-oi1-x241.google.com (mail-oi1-x241.google.com [IPv6:2607:f8b0:4864:20::241]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F43BC0613CF for ; Thu, 5 Nov 2020 03:16:47 -0800 (PST) Received: by mail-oi1-x241.google.com with SMTP id x1so1250034oic.13 for ; Thu, 05 Nov 2020 03:16:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UszkOiciKi1uHSlkdshllKEw9+T6ITNIT1mnjF8bYTY=; b=R0t4CKpyo+uaCbfna6NGaIp9rLnm26RsohzyWNNDVpMXpRLkwzdJoPYsdthmBnsJi+ izN+ltDHSwXYQ+7GMJORyR+T+1JeK3FjYoLK401V0Y2cCRvxXvHANDwXmSoTwq0+1zEw ecoDwMZ8RZWe0v5Pe1lPc/iAujCW8VgaahM1s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UszkOiciKi1uHSlkdshllKEw9+T6ITNIT1mnjF8bYTY=; b=o8zHEzoxgkBVL9fmR26Uc3nHYRHs5+diam0UoACqC0JdRcyr22a/YCht/PIOY9QBtK Ll6OZrkn6e5WOiFWIR9SMLOAfRl2uwnJAxWN4K/OhAPyBmLO3tyH+8zOGHiVbqKl0G1r 0Z+X/HnB4IS8o/jYNWzq+bwpzOLcRMaljRUgG4JNdPX0u1D7yfsyOgMkygmIbtoqnXMa 8ryyoqxuJqMMsmzXucDsHCip8Frvx3VX2zEh9Nn5S643PjwyYLrZNVYaFMN2WakclbWJ uloB/ch09tyWpz27PfEWRl7dxDjsuFKGDtEaLt0d4Ytvwk5wN9FXzFKWoYteOnesb8EH Heaw== X-Gm-Message-State: AOAM532rC36qYkZAmKLDZ5k5U4oj9JUG3QPnc+g18pNhHh4njfkUMdEG ftprAj4zqcHTajlMBJz5/aGPHynWbvv62lnI9lKisHBmWS3WPg== X-Google-Smtp-Source: ABdhPJy7rvSgYNi1XYKgWMkyr7U0fbTSy8ZOBfLBzFaROy9lsHMPGmQFMIqiUbMl7tzF52kCTP0NO6wtuawINX+sUVc= X-Received: by 2002:aca:b141:: with SMTP id a62mr1132355oif.101.1604575006528; Thu, 05 Nov 2020 03:16:46 -0800 (PST) MIME-Version: 1.0 References: <20201104112338.GA29271@localhost> <20201105094215.GT401619@phenom.ffwll.local> <20201105103116.GA29881@localhost> In-Reply-To: <20201105103116.GA29881@localhost> From: Daniel Vetter Date: Thu, 5 Nov 2020 12:16:34 +0100 Message-ID: Subject: Re: [PATCH] drm/vgm: replace idr_init() by idr_init_base() To: Deepak R Varma Cc: David Airlie , dri-devel , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Nov 5, 2020 at 11:31 AM Deepak R Varma wrote: > > On Thu, Nov 05, 2020 at 10:42:15AM +0100, Daniel Vetter wrote: > > On Wed, Nov 04, 2020 at 04:53:38PM +0530, Deepak R Varma wrote: > > > idr_init() uses base 0 which is an invalid identifier. The new function > > > idr_init_base allows IDR to set the ID lookup from base 1. This avoids > > > all lookups that otherwise starts from 0 since 0 is always unused. > > > > > > References: commit 6ce711f27500 ("idr: Make 1-based IDRs more efficient") > > > > > > Signed-off-by: Deepak R Varma > > > > Tiny typo in the commit message summary: s/vgm/vgem/ > > > > Also can you pls resbumit this with intel-gfx mailing list on cc (like for > > i915)? There's a CI bot there which runs a few vgem tests, would be good > > to confirm nothing has been broken. > > Hi Daniel, > sure. I will correct the summary typo and also feed it to the CI bot. > > Also, according to Felix Kuehling's comment on a similar patch for > drm/amdkfd driver, an ID can be 0. The change I am proposing is more > efficient for conditions that do not want to use ID as 0. Otherwise, > id = 0 is an acceptable possibility. So, my statement that "Id 0 is an invalid > identifier" is not true. > > Can you please comment if this is accurate and I should reword my log > message as well? You need to review the vgem code to see whether we're using id 0 as invalid identifier or not. That's part of the work that needs to be done here. Best would be to explain the evidence you've found in the commit message, why id 0 is invalid for this specific code. Since yes in general that's not true, it depends how the idr is used. -Daniel > > Thank you. > ./drv > > > > > Otherwise lgtm. > > > > Thanks, Daniel > > > > > --- > > > drivers/gpu/drm/vgem/vgem_fence.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/gpu/drm/vgem/vgem_fence.c b/drivers/gpu/drm/vgem/vgem_fence.c > > > index 17f32f550dd9..2902dc6e64fa 100644 > > > --- a/drivers/gpu/drm/vgem/vgem_fence.c > > > +++ b/drivers/gpu/drm/vgem/vgem_fence.c > > > @@ -233,7 +233,7 @@ int vgem_fence_signal_ioctl(struct drm_device *dev, > > > int vgem_fence_open(struct vgem_file *vfile) > > > { > > > mutex_init(&vfile->fence_mutex); > > > - idr_init(&vfile->fence_idr); > > > + idr_init_base(&vfile->fence_idr, 1); > > > > > > return 0; > > > } > > > -- > > > 2.25.1 > > > > > > > -- > > Daniel Vetter > > Software Engineer, Intel Corporation > > http://blog.ffwll.ch -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D8A4FC388F7 for ; Thu, 5 Nov 2020 11:16:50 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D9B9A2078E for ; Thu, 5 Nov 2020 11:16:49 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="R0t4CKpy" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D9B9A2078E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 66FDD6E1F4; Thu, 5 Nov 2020 11:16:48 +0000 (UTC) Received: from mail-oi1-x242.google.com (mail-oi1-x242.google.com [IPv6:2607:f8b0:4864:20::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 965416E1F4 for ; Thu, 5 Nov 2020 11:16:47 +0000 (UTC) Received: by mail-oi1-x242.google.com with SMTP id k26so1308436oiw.0 for ; Thu, 05 Nov 2020 03:16:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UszkOiciKi1uHSlkdshllKEw9+T6ITNIT1mnjF8bYTY=; b=R0t4CKpyo+uaCbfna6NGaIp9rLnm26RsohzyWNNDVpMXpRLkwzdJoPYsdthmBnsJi+ izN+ltDHSwXYQ+7GMJORyR+T+1JeK3FjYoLK401V0Y2cCRvxXvHANDwXmSoTwq0+1zEw ecoDwMZ8RZWe0v5Pe1lPc/iAujCW8VgaahM1s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UszkOiciKi1uHSlkdshllKEw9+T6ITNIT1mnjF8bYTY=; b=bdtZUKK9Knd6+6+Pi5cnJp0qNH5/+JKAHZcv4oH+0+ohOtwWF2ZaZycGselZGEVfD/ gxN6Z67eSWZL5BmArfwey77BC9QmPEkIf8PZWc8vsupLU40A8NSmuYer0ufR6T1vaxn2 /vFi/qlSLlWkpunfS/Yv0yYpnOomv7hcXHkbaYkHFOvpZO3lBZYmHKfxTRqsREi0t459 c3FKfu3UgDmrk2Yq1FcmUGZUMobhsz+J9OPSGb1hnkg+CXDldCiTzQSyGOIffcCrcA7B 5U82OjpMnAOOBLvNc6evjek+t6S8k4173ivuUC0s5OjewnVUiXOv39iAV2DV6vt8LCX9 tZsg== X-Gm-Message-State: AOAM5327bhryqWkfs3ZIV2ZKuO043LcjL2SSJScMgGlFr9rUIy+8hVH3 l1Kp8KNg91MTqUDBTTF5CPwBZu1ZJK0onmp+f9DwLQ== X-Google-Smtp-Source: ABdhPJy7rvSgYNi1XYKgWMkyr7U0fbTSy8ZOBfLBzFaROy9lsHMPGmQFMIqiUbMl7tzF52kCTP0NO6wtuawINX+sUVc= X-Received: by 2002:aca:b141:: with SMTP id a62mr1132355oif.101.1604575006528; Thu, 05 Nov 2020 03:16:46 -0800 (PST) MIME-Version: 1.0 References: <20201104112338.GA29271@localhost> <20201105094215.GT401619@phenom.ffwll.local> <20201105103116.GA29881@localhost> In-Reply-To: <20201105103116.GA29881@localhost> From: Daniel Vetter Date: Thu, 5 Nov 2020 12:16:34 +0100 Message-ID: Subject: Re: [PATCH] drm/vgm: replace idr_init() by idr_init_base() To: Deepak R Varma X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , Linux Kernel Mailing List , dri-devel Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Thu, Nov 5, 2020 at 11:31 AM Deepak R Varma wrote: > > On Thu, Nov 05, 2020 at 10:42:15AM +0100, Daniel Vetter wrote: > > On Wed, Nov 04, 2020 at 04:53:38PM +0530, Deepak R Varma wrote: > > > idr_init() uses base 0 which is an invalid identifier. The new function > > > idr_init_base allows IDR to set the ID lookup from base 1. This avoids > > > all lookups that otherwise starts from 0 since 0 is always unused. > > > > > > References: commit 6ce711f27500 ("idr: Make 1-based IDRs more efficient") > > > > > > Signed-off-by: Deepak R Varma > > > > Tiny typo in the commit message summary: s/vgm/vgem/ > > > > Also can you pls resbumit this with intel-gfx mailing list on cc (like for > > i915)? There's a CI bot there which runs a few vgem tests, would be good > > to confirm nothing has been broken. > > Hi Daniel, > sure. I will correct the summary typo and also feed it to the CI bot. > > Also, according to Felix Kuehling's comment on a similar patch for > drm/amdkfd driver, an ID can be 0. The change I am proposing is more > efficient for conditions that do not want to use ID as 0. Otherwise, > id = 0 is an acceptable possibility. So, my statement that "Id 0 is an invalid > identifier" is not true. > > Can you please comment if this is accurate and I should reword my log > message as well? You need to review the vgem code to see whether we're using id 0 as invalid identifier or not. That's part of the work that needs to be done here. Best would be to explain the evidence you've found in the commit message, why id 0 is invalid for this specific code. Since yes in general that's not true, it depends how the idr is used. -Daniel > > Thank you. > ./drv > > > > > Otherwise lgtm. > > > > Thanks, Daniel > > > > > --- > > > drivers/gpu/drm/vgem/vgem_fence.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/gpu/drm/vgem/vgem_fence.c b/drivers/gpu/drm/vgem/vgem_fence.c > > > index 17f32f550dd9..2902dc6e64fa 100644 > > > --- a/drivers/gpu/drm/vgem/vgem_fence.c > > > +++ b/drivers/gpu/drm/vgem/vgem_fence.c > > > @@ -233,7 +233,7 @@ int vgem_fence_signal_ioctl(struct drm_device *dev, > > > int vgem_fence_open(struct vgem_file *vfile) > > > { > > > mutex_init(&vfile->fence_mutex); > > > - idr_init(&vfile->fence_idr); > > > + idr_init_base(&vfile->fence_idr, 1); > > > > > > return 0; > > > } > > > -- > > > 2.25.1 > > > > > > > -- > > Daniel Vetter > > Software Engineer, Intel Corporation > > http://blog.ffwll.ch -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel