From patchwork Mon Dec 11 10:30:46 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Tucker X-Patchwork-Id: 121347 Delivered-To: patch@linaro.org Received: by 10.80.152.193 with SMTP id j59csp2574585edb; Mon, 11 Dec 2017 02:30:51 -0800 (PST) X-Google-Smtp-Source: AGs4zMapOqEe4Yx6ltO6c4yA1QhJKAvkusVSZtGp/P++XPaHYcBv235hfdrm4aNDI2CA7gEqI5FP X-Received: by 10.159.202.151 with SMTP id p23mr17377137plo.366.1512988251820; Mon, 11 Dec 2017 02:30:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512988251; cv=none; d=google.com; s=arc-20160816; b=TGEpF++IYp62YOArgq7xtB2FS0sCekR7ITqHKDMYWE4unAyaLGrlUGgSamJReXRGDz xTjbsk0+kPju9MPTvaNsKmnp/JWBVtbCj4HQKNIukmS/dOTnVpD6Dej75998HSiibvP+ H3V7GgZRvG9cLoCor55UD15oyR9dFSv372gVyChW63LDwiGnY8rZEcX5bRrChYbjmD0q sj4tJP5iZlvVbjqt1XaCuucaiic2/DNXregYp1PYOvRmmjHQ6lhpC5LHt/fpujuB0d+L uB9FwvnS6KxLTPMp47UA0Z+LWyllIarZUlZbg1Obnpn0m1bLAlaD1z2yZ6dhhNYgfUih UT5Q== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:cc:to:references:subject:arc-authentication-results; bh=KmvXjkjJXdLUm2jB+H09RYhVpIawpQhHZ3Tgw1omYtc=; b=MF5307bROdfbsXMmcqe/vJRp3F1hOn3aALksQGke8yEkNcbfxfyQOVIcxwURECZpxV L/gkp4ExIgQ3cxrdm8fqeyJEiDA+1pzHS93+3DYNDSyN3u/6JHxnw6cJ1gai0wlL2cSQ F4x9bXdh/CbOYpz24vAIn0XeGtITWhsimho6ZK5lwp+UN15qQ6ZHRg1nRyKw38IsKHie kTqV4rMaJ/4adG2kIJzNyNSxwXFPBj3wGUKKn60gNnJteccCWllPwoaR6oNu6TmwiEzK AKzIF7uS9l/TQapa7Pui6qCIUbvfQfk7z+J6Wb8XixXyrHW4HTeadE4nUu729pRjTUP9 9Ujw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r79si10808032pfd.156.2017.12.11.02.30.51; Mon, 11 Dec 2017 02:30:51 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-samsung-soc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-samsung-soc-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751433AbdLKKav (ORCPT + 3 others); Mon, 11 Dec 2017 05:30:51 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:55748 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751347AbdLKKau (ORCPT ); Mon, 11 Dec 2017 05:30:50 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: gtucker) with ESMTPSA id 60954260C95 Subject: Fwd: mainline/master boot bisection: v4.15-rc3 on peach-pi #3228-staging References: <680389204.71.1512980755810.JavaMail.jenkins@ip-172-30-0-246> To: Daniel Vetter Cc: Mark Brown , Kevin Hilman , Matt Hart , Thierry Escande , Tomeu Vizoso , Enric Balletbo i Serra , linux-samsung-soc@vger.kernel.org, kernel-build-reports@lists.linaro.org, linux-arm-kernel@lists.infradead.org From: Guillaume Tucker X-Forwarded-Message-Id: <680389204.71.1512980755810.JavaMail.jenkins@ip-172-30-0-246> Message-ID: <51e6d7fb-ac9e-a59f-ea63-ad06219b429d@collabora.com> Date: Mon, 11 Dec 2017 10:30:46 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0 MIME-Version: 1.0 In-Reply-To: <680389204.71.1512980755810.JavaMail.jenkins@ip-172-30-0-246> Content-Language: en-US Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Hi Daniel, Please see below, I've had several bisection results pointing at that commit over the week-end on mainline but also on linux-next and net-next. While the peach-pi is a bit flaky at the moment and is likely to have more than one issue, it does seem like this commit is causing some well reproducible kernel hang. Here's a re-run with v4.15-rc3 showing the issue: https://lava.collabora.co.uk/scheduler/job/1018478 and here's another one with the change mentioned below reverted: https://lava.collabora.co.uk/scheduler/job/1018479 They both show a warning about "unbalanced disables for lcd_vdd", I don't know if this is related as I haven't investigated any further. It does appear to reliably hang with v4.15-rc3 and boot most of the time with the commit reverted though. The automated kernelci.org bisection is still an experimental tool and it may well be a false positive, so please take this result with a pinch of salt... Hope this helps! Best wishes, Guillaume -------- Forwarded Message -------- Subject: mainline/master boot bisection: v4.15-rc3 on peach-pi #3228-staging Date: Mon, 11 Dec 2017 08:25:55 +0000 (UTC) From: kernelci.org bot To: guillaume.tucker@collabora.com Bisection result for mainline/master (v4.15-rc3) on peach-pi Good known revision: c6b3e96 Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux Bad known revision: 50c4c4e Linux 4.15-rc3 Extra parameters: Tree: mainline Branch: master Target: peach-pi Lab: lab-collabora Defconfig: exynos_defconfig Plan: boot Breaking commit found: ------------------------------------------------------------------------------- commit a703c55004e1c5076d57e43771b3e11117796ea0 Author: Daniel Vetter Date: Mon Dec 4 21:48:18 2017 +0100 drm: safely free connectors from connector_iter In commit 613051dac40da1751ab269572766d3348d45a197 Author: Daniel Vetter Date: Wed Dec 14 00:08:06 2016 +0100 drm: locking&new iterators for connector_list we've went to extreme lengths to make sure connector iterations works in any context, without introducing any additional locking context. This worked, except for a small fumble in the implementation: When we actually race with a concurrent connector unplug event, and our temporary connector reference turns out to be the final one, then everything breaks: We call the connector release function from whatever context we happen to be in, which can be an irq/atomic context. And connector freeing grabs all kinds of locks and stuff. Fix this by creating a specially safe put function for connetor_iter, which (in this rare case) punts the cleanup to a worker. Reported-by: Ben Widawsky Cc: Ben Widawsky Fixes: 613051dac40d ("drm: locking&new iterators for connector_list") Cc: Dave Airlie Cc: Chris Wilson Cc: Sean Paul Cc: # v4.11+ Reviewed-by: Dave Airlie Signed-off-by: Daniel Vetter Link: https://patchwork.freedesktop.org/patch/msgid/20171204204818.24745-1-daniel.vetter@ffwll.ch ------------------------------------------------------------------------------- Git bisection log: ------------------------------------------------------------------------------- git bisect start # good: [c6b3e9693f8a32ba3b07e2f2723886ea2aff4e94] Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux git bisect good c6b3e9693f8a32ba3b07e2f2723886ea2aff4e94 # bad: [50c4c4e268a2d7a3e58ebb698ac74da0de40ae36] Linux 4.15-rc3 git bisect bad 50c4c4e268a2d7a3e58ebb698ac74da0de40ae36 # bad: [e9ef1fe312b533592e39cddc1327463c30b0ed8d] Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net git bisect bad e9ef1fe312b533592e39cddc1327463c30b0ed8d # bad: [77071bc6c472bb0b36818f3e9595114cdf98c86d] Merge tag 'media/v4.15-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media git bisect bad 77071bc6c472bb0b36818f3e9595114cdf98c86d # bad: [4066aa72f9f2886105c6f747d7f9bd4f14f53c12] Merge tag 'drm-fixes-for-v4.15-rc3' of git://people.freedesktop.org/~airlied/linux git bisect bad 4066aa72f9f2886105c6f747d7f9bd4f14f53c12 # bad: [96980844bb4b74d2e7ce93d907670658e39a3992] Merge tag 'drm-intel-fixes-2017-12-07' of git://anongit.freedesktop.org/drm/drm-intel into drm-fixes git bisect bad 96980844bb4b74d2e7ce93d907670658e39a3992 # bad: [120a264f9c2782682027d931d83dcbd22e01da80] drm/exynos: gem: Drop NONCONTIG flag for buffers allocated without IOMMU git bisect bad 120a264f9c2782682027d931d83dcbd22e01da80 # good: [2bf257d662509553ae226239e7dc1c3d00636ca6] drm/ttm: roundup the shrink request to prevent skip huge pool git bisect good 2bf257d662509553ae226239e7dc1c3d00636ca6 # good: [db8f884ca7fe6af64d443d1510464efe23826131] Merge branch 'drm-fixes-4.15' of git://people.freedesktop.org/~agd5f/linux into drm-fixes git bisect good db8f884ca7fe6af64d443d1510464efe23826131 # bad: [bd3a3a2e92624942a143e485c83e641b2492d828] Merge tag 'drm-misc-fixes-2017-12-06' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes git bisect bad bd3a3a2e92624942a143e485c83e641b2492d828 # bad: [a703c55004e1c5076d57e43771b3e11117796ea0] drm: safely free connectors from connector_iter git bisect bad a703c55004e1c5076d57e43771b3e11117796ea0 # first bad commit: [a703c55004e1c5076d57e43771b3e11117796ea0] drm: safely free connectors from connector_iter ------------------------------------------------------------------------------- -- To unsubscribe from this list: send the line "unsubscribe linux-samsung-soc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 25f4b2e..4820141 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -152,6 +152,16 @@ static void drm_connector_free(struct kref *kref) connector->funcs->destroy(connector); } +static void drm_connector_free_work_fn(struct work_struct *work) +{ + struct drm_connector *connector = + container_of(work, struct drm_connector, free_work); + struct drm_device *dev = connector->dev; + + drm_mode_object_unregister(dev, &connector->base); + connector->funcs->destroy(connector); +} + /** * drm_connector_init - Init a preallocated connector * @dev: DRM device @@ -181,6 +191,8 @@ int drm_connector_init(struct drm_device *dev, if (ret) return ret; + INIT_WORK(&connector->free_work, drm_connector_free_work_fn); + connector->base.properties = &connector->properties; connector->dev = dev; connector->funcs = funcs; @@ -529,6 +541,18 @@ void drm_connector_list_iter_begin(struct drm_device *dev, } EXPORT_SYMBOL(drm_connector_list_iter_begin); +/* + * Extra-safe connector put function that works in any context. Should only be + * used from the connector_iter functions, where we never really expect to + * actually release the connector when dropping our final reference. + */ +static void +drm_connector_put_safe(struct drm_connector *conn) +{ + if (refcount_dec_and_test(&conn->base.refcount.refcount)) + schedule_work(&conn->free_work); +} + /** * drm_connector_list_iter_next - return next connector * @iter: connectr_list iterator @@ -561,7 +585,7 @@ drm_connector_list_iter_next(struct drm_connector_list_iter *iter) spin_unlock_irqrestore(&config->connector_list_lock, flags); if (old_conn) - drm_connector_put(old_conn); + drm_connector_put_safe(old_conn); return iter->conn; } @@ -580,7 +604,7 @@ void drm_connector_list_iter_end(struct drm_connector_list_iter *iter) { iter->dev = NULL; if (iter->conn) - drm_connector_put(iter->conn); + drm_connector_put_safe(iter->conn); lock_release(&connector_list_iter_dep_map, 0, _RET_IP_); } EXPORT_SYMBOL(drm_connector_list_iter_end); diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c index cda8bfa..cc78b3d 100644 --- a/drivers/gpu/drm/drm_mode_config.c +++ b/drivers/gpu/drm/drm_mode_config.c @@ -431,6 +431,8 @@ void drm_mode_config_cleanup(struct drm_device *dev) drm_connector_put(connector); } drm_connector_list_iter_end(&conn_iter); + /* connector_iter drops references in a work item. */ + flush_scheduled_work(); if (WARN_ON(!list_empty(&dev->mode_config.connector_list))) { drm_connector_list_iter_begin(dev, &conn_iter); drm_for_each_connector_iter(connector, &conn_iter) diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index df9807a..a4649c5 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -916,6 +916,14 @@ struct drm_connector { uint8_t num_h_tile, num_v_tile; uint8_t tile_h_loc, tile_v_loc; uint16_t tile_h_size, tile_v_size; + + /** + * @free_work: + * + * Work used only by &drm_connector_iter to be able to clean up a + * connector from any context. + */ + struct work_struct free_work; }; #define obj_to_connector(x) container_of(x, struct drm_connector, base)