Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp265744imm; Wed, 18 Jul 2018 01:36:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpf74Ffx5JjucVzWmYq8RBDE2EEUxD/betLI+IcxlRxxHH9WKvTsfU+UdSg1PP9fh9D4TFMP X-Received: by 2002:a63:1f4d:: with SMTP id q13-v6mr4903641pgm.241.1531902970006; Wed, 18 Jul 2018 01:36:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531902969; cv=none; d=google.com; s=arc-20160816; b=XHrrMZehz93zQ67pkcUad3rpTMS2fJkRsk8BK5Y1039v5eHabyVGdtbgvEKx+Yr/z5 GprOORtlcpP2gygA91U6i2kPZYNudy5Ypw2eO1akNd3Yzmg4F/Id6pK+8C0AO+p1tBqL HqmoiMylK4O79hNg4K+jyEdTjqtQATaxJrpymUs7UTjdiH+C4+zWbm6rzSbgXFWYYb1p 4NqYLg6bKU6XXNFFCOMEKeM3PUIhF3NpN0vQ9AcOPuq5O7wdpEpjSPfXWtIIJH/qhjso qM19b0z++0md8oYeH4ZCV8cspR+Q9v3ZIgmydjbdUKqdF01fmJX/p4BmTS8/u2f+Qr6u Pj5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=gbBupZM07/fZOi8UjGpynCJsGGRFoUIYIj+VDKmKmtE=; b=b/D4DuXbM88K/Mmec7Oj5Cxnc0Y1m/do/kSNJowrTNU/ZsmtjZ2ASrdfjWn6x/hMmv 6eHm1f/kgsnRp7RewjWJvbPhPmzwbrfjCbQuqP8esjPjoPHTtHxBlrFjDCC7XO2i+Mwx +THUhwZhsdz2/Uzvg8CPB06Ei6nvbmAo2oPlV/ct9aQpAb2wZG+D5vxZHNOtLtk4cJm7 8MvrZ6d9auw/NhJOyRU03YiFx3xFpDcVGQD58ZeykinOjrzNn7ZQVHgq1tFUJvjKVNO/ Fba+qdLE7b7ohDBzopIaN6c7P5gb7a9AeQ/RQnNnAdS4xJDZcn4inwiDbqDU0eW67Vn1 9u4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=uvw+Qvn7; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d24-v6si2720341plr.178.2018.07.18.01.35.54; Wed, 18 Jul 2018 01:36:09 -0700 (PDT) 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=fail header.i=@gmail.com header.s=20161025 header.b=uvw+Qvn7; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730057AbeGRJMH (ORCPT + 99 others); Wed, 18 Jul 2018 05:12:07 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:38943 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726180AbeGRJMH (ORCPT ); Wed, 18 Jul 2018 05:12:07 -0400 Received: by mail-oi0-f65.google.com with SMTP id d189-v6so7264237oib.6; Wed, 18 Jul 2018 01:35:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=gbBupZM07/fZOi8UjGpynCJsGGRFoUIYIj+VDKmKmtE=; b=uvw+Qvn7z3r+CukYqeq9+84/OTLUspdPTYHThb0JeHMIVpjcXyN4OCdKDhJdYNgNvO cvqOOErEjIVvNNqTOkgarTZYJ1pKx7iSCTdVAeVSXGLk+D6mDT3askTVGzveJswN49Ne OrRv5dhPgFnCaDM4mgaX66D1YKlYDax6dRB+/5wLuwvPp2ggb1NJywYZPIXUY2egaE0d lUB0fJhEFGSLOlNqwirwCPQY5Xx4DQJqZZM3NCV9KmkPlwHf4oE7eNj88o7/VQoOsMYg SYk8NPlTgY1WkFszRAVK5k4D2obnlFeXk8Ar9yp+CKr+QEx3lFYosOyyNAD67y4o2qme SUpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=gbBupZM07/fZOi8UjGpynCJsGGRFoUIYIj+VDKmKmtE=; b=r5C1gR454TD6K+SCi9GTLMufSXK8UwA9wto7GCw0pIcEygdvW52W8jCXOi8G3elGuR 25aKjr2ZTGscxsZPMRsK+sBiqHa8SS+xuV6PXUDs0TxUJCTl/kY0P+V5DrxZ1uVaKcKj EDOuwEZzEWaWNrWWXCWJTgoaBCH5fIiW3xcQaU1N4JAHfLFIW4pIwKukEQHeoAqdh/Om e6G4mqCmLQxsL8ObAdKUKYX1QJRqWxRI/sTBIYrf75F2bhNDAWn1o7m+3OQC/1yBi25N CiZVFnAuBPKDMr8dKtyAXvx06htm8xgQ+iiVr19/IroFcjmGOqPaxyjNhgXoEQpIjiac JBow== X-Gm-Message-State: AOUpUlFR9otxAfNWqVxNfuToHVligyxSfcrWCjGLGj1qm3TJgVEF2muF ODcQTzsZPVTdaVPmYz1w4Zqj0yFmewmfsWl8SBo= X-Received: by 2002:aca:b841:: with SMTP id i62-v6mr5198823oif.358.1531902918920; Wed, 18 Jul 2018 01:35:18 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:63d2:0:0:0:0:0 with HTTP; Wed, 18 Jul 2018 01:35:18 -0700 (PDT) In-Reply-To: <20180718082505.GB16072@wunner.de> References: <20180716235936.11268-1-lyude@redhat.com> <20180716235936.11268-2-lyude@redhat.com> <20180717071641.GA5411@wunner.de> <20180717182041.GA18363@wunner.de> <20180718082505.GB16072@wunner.de> From: "Rafael J. Wysocki" Date: Wed, 18 Jul 2018 10:35:18 +0200 X-Google-Sender-Auth: M9uyVHAyOb1XHlaUGBqnIaGYp90 Message-ID: Subject: Re: [Nouveau] [PATCH 1/5] drm/nouveau: Prevent RPM callback recursion in suspend/resume paths To: Lukas Wunner Cc: "Rafael J. Wysocki" , Lyude Paul , nouveau@lists.freedesktop.org, David Airlie , Linux Kernel Mailing List , dri-devel , Ben Skeggs , Linux PM Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 18, 2018 at 10:25 AM, Lukas Wunner wrote: > On Wed, Jul 18, 2018 at 09:38:41AM +0200, Rafael J. Wysocki wrote: >> On Tue, Jul 17, 2018 at 8:20 PM, Lukas Wunner wrote: >> > Okay, the PCI device is suspending and the nvkm_i2c_aux_acquire() >> > wants it in resumed state, so is waiting forever for the device to >> > runtime suspend in order to resume it again immediately afterwards. >> > >> > The deadlock in the stack trace you've posted could be resolved using >> > the technique I used in d61a5c106351 by adding the following to >> > include/linux/pm_runtime.h: >> > >> > static inline bool pm_runtime_status_suspending(struct device *dev) >> > { >> > return dev->power.runtime_status == RPM_SUSPENDING; >> > } >> > >> > static inline bool is_pm_work(struct device *dev) >> > { >> > struct work_struct *work = current_work(); >> > >> > return work && work->func == dev->power.work; >> > } >> > >> > Then adding this to nvkm_i2c_aux_acquire(): >> > >> > struct device *dev = pad->i2c->subdev.device->dev; >> > >> > if (!(is_pm_work(dev) && pm_runtime_status_suspending(dev))) { >> > ret = pm_runtime_get_sync(dev); >> > if (ret < 0 && ret != -EACCES) >> > return ret; >> > } > [snip] >> >> For the record, I don't quite like this approach as it seems to be >> working around a broken dependency graph. >> >> If you need to resume device A from within the runtime resume callback >> of device B, then clearly B depends on A and there should be a link >> between them. >> >> That said, I do realize that it may be the path of least resistance, >> but then I wonder if we can do better than this. > > The GPU contains an i2c subdevice for each connector with DDC lines. > I believe those are modelled as children of the GPU's PCI device as > they're accessed via mmio of the PCI device. > > The problem here is that when the GPU's PCI device runtime suspends, > its i2c child device needs to be runtime active to suspend the MST > topology. Catch-22. I see. This sounds like a case for the ignore_children flag, maybe in a slightly modified form, that will allow the parent to be suspended regardless of the state of the children. I wonder what happens to the I2C subdevices when the PCI device goes into D3. They are not accessible through MMIO any more then, so how can they be suspended then? Or do they need to be suspended at all? > I don't know whether or not it's necessary to suspend the MST topology. > I'm not an expert on DisplayPort MultiStream transport. Me neither. :-)