Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp1006628imm; Wed, 18 Jul 2018 14:51:10 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdj83Dv/gpnxkMWvoPY//LwlsGZKbrq5LkUkp5QFXdNL1Iy/csg7pAeIAAy0lrB0MXxTFzu X-Received: by 2002:a63:9741:: with SMTP id d1-v6mr7139881pgo.403.1531950670143; Wed, 18 Jul 2018 14:51:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531950670; cv=none; d=google.com; s=arc-20160816; b=xhGsRILEqw8MVtMn3/JXTkgEGCzYZGUYM2lP1d1gehZVKJ1KfqU5R2u9Dc70GW/Ms6 R7AC9wwuwwqow5VuAEf+qdnx3AeyVGW2ImZdHIoU7Kk7MofV3TBOiPjMxEYYAxvcmAZZ KZgaooR+atai+4NL175rdeffw/+OQMWQuBVrb8UVN0t7GJ5pwqEH8gVoIslObmmgQ7j3 UOKbZngvT1okdMe3hjd3vyXKNL1SMusZdfHzuWgCrg98qgriQrO+h+aFZ29CG83MY19x 9aLjCOIXw1FfnEnG+EtizEEGQMX0Gh6Rr54UPLqX5xv1GA6WeGbs2JEidA1Snwrj2k1q s0zg== 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=JzP1GbmHmfs28MB5120US2zaMEU7Zv/tsNmwgXdd9Jk=; b=UePqELlRCI6vh6fZQpWUfX5MBQcoZg5oDiLncErdnDrh3NdwqL7MPUdukGqYHkT80P Uyd0K/ait2AWIn2pBV2cRNk3RDlK+LINF8GtHrR55Nd89EP9STSVu4K7C2jiQ7QbSHbd AkyyoW6BT+hc8UU87pndqn1xAudYgznAW5NxywQryuM9EFjov+F2PAvLSo0gl6CO3+hV NdSqY4e0W6yfZJC3EOjs/KjTWloqlqBH2iGyWbKgXsd3rzgurop6iV2FnmOHRTM6h6vY ff2Fy5lHAXRaEwFiq32pKbnpKxd8eYFVBR5Cpv4Dcny/b4ZhBpuHLpWylrghKP2rgfXg 0hGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=Af8V2x95; 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 s84-v6si4391238pfd.288.2018.07.18.14.50.55; Wed, 18 Jul 2018 14:51:10 -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=Af8V2x95; 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 S1730266AbeGRW3A (ORCPT + 99 others); Wed, 18 Jul 2018 18:29:00 -0400 Received: from mail-oi0-f65.google.com ([209.85.218.65]:38339 "EHLO mail-oi0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728467AbeGRW3A (ORCPT ); Wed, 18 Jul 2018 18:29:00 -0400 Received: by mail-oi0-f65.google.com with SMTP id v8-v6so11678137oie.5; Wed, 18 Jul 2018 14:49:09 -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=JzP1GbmHmfs28MB5120US2zaMEU7Zv/tsNmwgXdd9Jk=; b=Af8V2x95MAexVbru4woFDQi++Mep11K67ceU+WXfWJtR3euOlbXue0wMZdD8dwn1bB 4F+nJrZNAej2CDTieUCweuuYuA9lloe4CFfEHO9WzvDy82DQRenPoWD2g5z9PiYjrdIR KomV+4wXCncCTGD3yB3F4smFGwxsfPA+NpHiJt02C4UNVgEuHff9j237v/xkb4Xm2L+6 kFzCBZreAIx1QsU6fvuNjjaRDSE6sx7/xhVglb5/kgd14o2ubFDHWcuOy0h6FwvSlIfU gdTm3S8F5GDnBDj3QCf5gkOn7USS34u0n5eR/hmV6Y43QcM9Mzy2CbXFj5djjcFyky9O zcIA== 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=JzP1GbmHmfs28MB5120US2zaMEU7Zv/tsNmwgXdd9Jk=; b=RU6gmT5T9sPvkhaOzmL55lidDCezV+3IYmmoBPTwR+5QYCa8d/K3Swi9ulcM4D+THa 8Pf4iAL/uvVBOkqHkLLuMZmX16df5THCJEgx5MiIg1aNEtPE57WoFoAnph6SxCPzJXQr n0kzzh3Hmoeliiz/FHlnf7y6X00IqsjPKPgQosWN4+cr1z0y1N0ZEvakW5NcdrbBhkGx NW8HJtJyZpa28mgveK20gSfXcXdPNRlkziTM0DDY8AtWGI4P+zmb78FqAw6WecgC5fUD LxpUurz/aOx4koClEpIHw/pjt+26qrTVxRBPWP/06wEGVLEVWDNK8bgvmr8LUuhXgL5M cHqw== X-Gm-Message-State: AOUpUlFoVmWdChbvapy0g0buSH6ZcX//N1o6wwEIA453+ALu9KxMLCZQ RRYjCP1J4gaFKk5HGCTHEePjpH4UHS1kjCej8MI= X-Received: by 2002:aca:ccc4:: with SMTP id c187-v6mr7841912oig.282.1531950548555; Wed, 18 Jul 2018 14:49:08 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a9d:63d2:0:0:0:0:0 with HTTP; Wed, 18 Jul 2018 14:49:07 -0700 (PDT) In-Reply-To: <2724dd5eee8a1e4e523e43915fa184ad5afe1c59.camel@redhat.com> 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> <20180718083601.GC16072@wunner.de> <2724dd5eee8a1e4e523e43915fa184ad5afe1c59.camel@redhat.com> From: "Rafael J. Wysocki" Date: Wed, 18 Jul 2018 23:49:07 +0200 X-Google-Sender-Auth: W0iAbFJy8vZW5rwuSHwhzbR0c0U Message-ID: Subject: Re: [Nouveau] [PATCH 1/5] drm/nouveau: Prevent RPM callback recursion in suspend/resume paths To: Lyude Paul Cc: Lukas Wunner , "Rafael J. Wysocki" , 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:11 PM, Lyude Paul wrote: > On Wed, 2018-07-18 at 10:36 +0200, Lukas Wunner wrote: >> On Wed, Jul 18, 2018 at 10:25:05AM +0200, Lukas Wunner wrote: >> > 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 don't know whether or not it's necessary to suspend the MST topology. >> > I'm not an expert on DisplayPort MultiStream transport. >> > >> > BTW Lyude, in patch 4 and 5 of this series, you're runtime resuming >> > pad->i2c->subdev.device->dev. Is this the PCI device or is it the i2c >> > device? I'm always confused by nouveau's structs. In nvkm_i2c_bus_ctor() >> > I can see that the device you're runtime resuming is the parent of the >> > i2c_adapter: >> > >> > struct nvkm_device *device = pad->i2c->subdev.device; >> > [...] >> > bus->i2c.dev.parent = device->dev; >> > >> > If the i2c_adapter is a child of the PCI device, it's sufficient >> > to runtime resume the i2c_adapter, i.e. bus->i2c.dev, and this will >> > implicitly runtime resume its parent. >> >> Actually, having written all this I just remembered that we have this >> in the documentation: >> >> 8. "No-Callback" Devices >> >> Some "devices" are only logical sub-devices of their parent and cannot >> be >> power-managed on their own. [...] >> >> Subsystems can tell the PM core about these devices by calling >> pm_runtime_no_callbacks(). >> >> So it might actually be sufficient to just call pm_runtime_no_callbacks() > > I would have hoped so, but unfortunately it seems that > pm_runtime_no_callbacks() is already called by default for i2c adapters in > i2c_register_adapter(). Unfortunately this really can't fix the problem > though, because it will still try to runtime resume the parent device of the > i2c adapter, which still leads to deadlocking in the runtime suspend/resume > path. Well, there has to be a way to suspend all that thing without recursion or similar. If the adapter has no callbacks, then how is it possible for those callbacks to invoke any runtime PM helpers for any other devices? > Additionally; I did play around with ignore_children, but unfortunately this > isn't good enough either as it just means that our i2c devices won't wake the > GPU up on access. So on the one hand you want them to stay active over a suspend of the parent and on the other hand you want the parent to resume before them. Are these requirements really consistent with each other? > I'm pretty stumped here on trying to figure out any clean way to handle this > in the PM core if recursive resume calls are off the table. The only possible > solution I could see to this is if we could disable execution of runtime > callbacks in the context of a certain task (while all other tasks have to > honor the runtime PM callbacks), do what we need to do in suspend, then re- > enable them >> for the i2c devices... This sounds completely broken to me, sorry.