Received: by 10.223.176.5 with SMTP id f5csp596077wra; Fri, 9 Feb 2018 04:12:44 -0800 (PST) X-Google-Smtp-Source: AH8x225J29/Tsu5q5fZlqUUVK9vQZW/F1ntg74WZ8kJTCOnlrYcKKtTlEvOMdtPtNESpkTtVOesA X-Received: by 10.99.180.3 with SMTP id s3mr2244237pgf.148.1518178364479; Fri, 09 Feb 2018 04:12:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518178364; cv=none; d=google.com; s=arc-20160816; b=W41czJzRnOAIkayXKZVr8TcwFGQdNUxnxGARSlK5xl/qPIJzzgmlosrpNv2AOlrxBc 5l1s11pkCD1IwyUKUA5OVkxdtS16JSTM5hMlgXekRh4K8LhhVRH/xP2drTZqB1e+DnsG lBp67Vqxs4jcqlDJG+1aM5zk0FHbGtP3D4gGp8o+ok8kpsVCd9i2CfwKg8XPQEQywTMv mj6OPLTyHG0mSxIunmfbDJDNHoZudloDaPZAgJBaySu5nVi6ajQ7VAAh4hHa32ir0s/i oz5kijmaCAj7NQ0twuA0lALy1FH+6B8UcQqsj9ck+uGfAareICvV2n+GLp2lQbx96jGA yyZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=0T0HoqpCZYdQMOgOG++tgbB3uYudymDeshbsagpUIbk=; b=lqZjgAiv+pv9ToeSe2RZRAk1L6PGLd4AwCkg/1ok1dRdEwXCzWERwuRQ8TEUeoZFid a+oINMbPokB0j0zCfyqxHSDXg770h8TFIfccnCzpFlAlNdYMUKPIh/USTLxpF5lWsuMh KCy7h1LFT2HGOVtnhWObSYlHv2odyvTZXXIGYrztaXeCTb2xCVp2e+4UiGKZjvBpipFg MPMTWPx3FHBBuDQNa0tIHrUqp3D6U7HGtTzdLD5rYd3Fix4IK5nI8nlSl6DLyJ2VO6vD Szw8gfJTbXNbTPQEi0uZQySMxf92Oe/QksRauauZu9Ajhpzx2JFFcn9YQgu7UJ115zCp tgYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lHFktqgy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b3si1295779pgu.831.2018.02.09.04.12.30; Fri, 09 Feb 2018 04:12:44 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lHFktqgy; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752384AbeBIMLF (ORCPT + 99 others); Fri, 9 Feb 2018 07:11:05 -0500 Received: from mail-it0-f67.google.com ([209.85.214.67]:55555 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752086AbeBIMLD (ORCPT ); Fri, 9 Feb 2018 07:11:03 -0500 Received: by mail-it0-f67.google.com with SMTP id b66so10650248itd.5 for ; Fri, 09 Feb 2018 04:11:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0T0HoqpCZYdQMOgOG++tgbB3uYudymDeshbsagpUIbk=; b=lHFktqgycBJ3x+jANWJHtFr8/hmOQjHiHNCc/VV7gZ0QXpTkiIMnQHoh4veIyIccxQ 6LkCucjDn76fpgOt8+rgR5Kx6YpbIUN7kyyjQZZq3BQzSJ1JMvyqALosUG4AWJ5KHV65 5PbpDdAFDKjq7KCJy46gdAuBK9O10nIVJuLMw5eppV7eL00TOZoodiTWw5bMWVDe2TmG eO2KvMWeHBVU1b7eggUxmQbpBt+RRYIZkSZeNJck4M/yNbpDTcSbJ1XaIDS0kegfgmw+ MF0I7KOqjmN+P8M0VIPSdq95ut/RVBhHcIlGlb2SOwYF04UqpQ9ihCXULCGxjwTQfQxa YLhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=0T0HoqpCZYdQMOgOG++tgbB3uYudymDeshbsagpUIbk=; b=SR0DuoBZs5U7J+2pbfFhnqx2qPxnOpmHLaazGuOVqtpogJMw/KipQ1OVfqL2qTGivf L5RR4PZZDnQhuf2IHw1iYBTVXKE+cJn6//G3vlTuvzjMe+QZTraDY6WLLEuJhxEpv3SY sTkjLrNa0kBTTsHw5vBK0Rj4icVLd+JrVBrbVP+dU89q4T9qftRUY4pcWdQXNr/lxNzq OxT+HjKPEjLojTD/7tGcbcYS7y8bfnKUe2uv29L8lTHWr+vrVFR/6yV9yfLRaRUdv02T 9yUTtseNGJhuMXL7bp+MorxaD0k/I3FyPQVeT0q4/CRE4oZBaX3E1GIoMJxY2BRIm4BM 6Bfw== X-Gm-Message-State: APf1xPBEXYdrzVofB+jRreH2V+kmDdyyFdINgIchxi7813uq3zrTArri MZZ594mdxbzpvYrJ0x80z2O39w== X-Received: by 10.36.9.11 with SMTP id 11mr3012268itm.129.1518178263355; Fri, 09 Feb 2018 04:11:03 -0800 (PST) Received: from shreeya-VirtualBox ([103.212.140.131]) by smtp.gmail.com with ESMTPSA id t84sm2889572iod.6.2018.02.09.04.11.01 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Feb 2018 04:11:02 -0800 (PST) From: Shreeya Patel To: daniel@ffwll.ch, airlied@redhat.com, airlied@linux.ie, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, seanpaul@chromium.org Cc: Shreeya Patel Subject: [PATCH] gpu/drm/udl: Replace struct_mutex with driver private lock Date: Fri, 9 Feb 2018 17:40:56 +0530 Message-Id: <1518178256-17157-1-git-send-email-shreeya.patel23498@gmail.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org dev->struct_mutex is the Big DRM Lock and the only bit where it’s mandatory is serializing GEM buffer object destruction. Which unfortunately means drivers have to keep track of that lock and either call unreference or unreference_locked depending upon context. Core GEM doesn’t have a need for struct_mutex any more since kernel 4.8. For drivers that need struct_mutex it should be replaced by a driver private lock. Signed-off-by: Shreeya Patel --- drivers/gpu/drm/udl/udl_dmabuf.c | 5 +++-- drivers/gpu/drm/udl/udl_drv.h | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/udl/udl_dmabuf.c b/drivers/gpu/drm/udl/udl_dmabuf.c index 2867ed1..120d2d9 100644 --- a/drivers/gpu/drm/udl/udl_dmabuf.c +++ b/drivers/gpu/drm/udl/udl_dmabuf.c @@ -76,6 +76,7 @@ static struct sg_table *udl_map_dma_buf(struct dma_buf_attachment *attach, struct udl_drm_dmabuf_attachment *udl_attach = attach->priv; struct udl_gem_object *obj = to_udl_bo(attach->dmabuf->priv); struct drm_device *dev = obj->base.dev; + struct udl_device *udl = dev->dev_private; struct scatterlist *rd, *wr; struct sg_table *sgt = NULL; unsigned int i; @@ -112,7 +113,7 @@ static struct sg_table *udl_map_dma_buf(struct dma_buf_attachment *attach, return ERR_PTR(-ENOMEM); } - mutex_lock(&dev->struct_mutex); + mutex_lock(&udl->urbs.plock); rd = obj->sg->sgl; wr = sgt->sgl; @@ -137,7 +138,7 @@ static struct sg_table *udl_map_dma_buf(struct dma_buf_attachment *attach, attach->priv = udl_attach; err_unlock: - mutex_unlock(&dev->struct_mutex); + mutex_unlock(&udl->urbs.plock); return sgt; } diff --git a/drivers/gpu/drm/udl/udl_drv.h b/drivers/gpu/drm/udl/udl_drv.h index 2a75ab8..24cca17 100644 --- a/drivers/gpu/drm/udl/udl_drv.h +++ b/drivers/gpu/drm/udl/udl_drv.h @@ -39,6 +39,7 @@ struct urb_node { struct urb_list { struct list_head list; + struct mutex plock; spinlock_t lock; struct semaphore limit_sem; int available; -- 2.7.4