Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp883292ybt; Sun, 14 Jun 2020 03:07:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSQ5rdl0U/asifKUM3HO1ETz98bWufsHIspp4pG/5MFv0BtpducrfqBupPUtghuNC2YAeW X-Received: by 2002:a17:906:9381:: with SMTP id l1mr21540170ejx.380.1592129224399; Sun, 14 Jun 2020 03:07:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592129224; cv=none; d=google.com; s=arc-20160816; b=znwPZj8Gu2y+Q+sSDteIM1an1E7DFV4u94p/q/ske5A3czfnSxA4f6a/JD7RQqHqZ5 iWoYexCuyZ8ew8HQhhqlKLe5s43h5gd02OXurScr3doZxkSLquqx9K/mNDmsg1OvMne+ 7ya4fNk37CD97xxtnYiu/bjhBpqZhU15e/cwSbHn4dS4q22HdGO/If6Wvgxh2bZc5y5x OVdWH7B+duRHbe5KokCNonwOKZppVNpq/2V2SzNU3ZLdAyQopLbg9v8yWAhl9XPVkJ0F KpswT/KRAf0AYIGxWHA5HGcUKkNNiwrIn/sc1vXDtgmHUtaYxqFxodqcVDGX+W9wpLVl jE5A== 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 :in-reply-to:references:mime-version; bh=ectOhExww/8c3ivMz3pON3O/nzr9APMG9dSXhsot2VE=; b=KtAKrPasrE4w7epKy2p9Djowtd0jNya4GtrNIYetg49IrhsTcooiERfs0GaGitatMp rU4kuy+893J6cUcdB2WPrqvtAN0Gul7krwyVTWE11UGUOEBp5JGueGZsdMi39/qwntgQ wFoYtiQiP3gdP0LabosawjzWdLLDz74z/FWBX1nWJJwaTpw7OY8F33NEH5qoYPv5X6vk LTQ7vB5HE/BshumnqzpVYMWGvUL+ZlhbOPVGMpLdHXFIhBXwVyXihd3efC/liCpkfGmc jJip9DpRK2hy8678kGRa55k4A2sEasq0ktm3G1K38Z6T16iSe+FqH3u+9fkDWdaseSAz H5KA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w22si6985410edv.31.2020.06.14.03.06.41; Sun, 14 Jun 2020 03:07:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726856AbgFNKFC (ORCPT + 99 others); Sun, 14 Jun 2020 06:05:02 -0400 Received: from mail-ot1-f67.google.com ([209.85.210.67]:39525 "EHLO mail-ot1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725265AbgFNKFB (ORCPT ); Sun, 14 Jun 2020 06:05:01 -0400 Received: by mail-ot1-f67.google.com with SMTP id g5so10826515otg.6; Sun, 14 Jun 2020 03:05:00 -0700 (PDT) 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=ectOhExww/8c3ivMz3pON3O/nzr9APMG9dSXhsot2VE=; b=bWYi+FGvNJZDX82AU6L/qLS3NgXl8D/jUk2mDLre/vwJPis0c4BwvqvuRhxbNqUX9t DDolpCvch07kJ88ghEnsucnh78ArsEzrMGDGkkX9ai2QBdpWTNb88KrBRhwOMyjF450x pQMKx1gcG3r1QjVTRk9pC6y3ruVRZeCnNdGupn0X/zbVrrT6OxtOEpJORdeo0Ercl6cw 9uATufMEf8eL6b5wGQvhOgNc9L8MMhpPmtQKujKTxqmO345u8v+CxQ0ctu8uom9tw0ts 3StjukAKQ7h4JvLvREjENeu1SMfcXK5Uexp+KD85+05jcrlyOtTg9LDsf11H4BS7q8nq qC2Q== X-Gm-Message-State: AOAM530eSWq/6Cyw8pDdUlP33qXbxfTmPI8SK7/lE98W50QHP5TMeut1 Z2GQTjAUQ6pw/48qHwSBt4JhF+IzgXrQQRzzDqW14A== X-Received: by 2002:a05:6830:141a:: with SMTP id v26mr17568846otp.250.1592129100501; Sun, 14 Jun 2020 03:05:00 -0700 (PDT) MIME-Version: 1.0 References: <20200614090751.GA2878@kunai> In-Reply-To: From: Geert Uytterhoeven Date: Sun, 14 Jun 2020 12:04:49 +0200 Message-ID: Subject: Re: RFC: a failing pm_runtime_get increases the refcnt? To: Andy Shevchenko Cc: Wolfram Sang , Linux PM , "Rafael J. Wysocki" , Linux-Renesas , Linux Kernel Mailing List , linux-i2c 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 Sun, Jun 14, 2020 at 12:00 PM Geert Uytterhoeven wrote: > On Sun, Jun 14, 2020 at 11:43 AM Andy Shevchenko > wrote: > > On Sun, Jun 14, 2020 at 12:34 PM Andy Shevchenko > > wrote: > > > > > > On Sun, Jun 14, 2020 at 12:10 PM Wolfram Sang wrote: > > > > both in the I2C subsystem and also for Renesas drivers I maintain, I am > > > > starting to get boilerplate patches doing some pm_runtime_put_* variant > > > > because a failing pm_runtime_get is supposed to increase the ref > > > > counters? Really? This feels wrong and unintuitive to me. > > > > > > Yeah, that is a well known issue with PM (I even have for a long time > > > a coccinelle script, when I realized myself that there are a lot of > > > cases like this, but someone else discovered this recently, like > > > opening a can of worms). > > > > > > > I expect there > > > > has been a discussion around it but I couldn't find it. > > > > > > Rafael explained (again) recently this. I can't find it quickly, unfortunately. > > > > I _think_ this discussion, but may be it's simple another tentacle of > > the same octopus. > > https://patchwork.ozlabs.org/project/linux-tegra/patch/20200520095148.10995-1-dinghao.liu@zju.edu.cn/ > > Thanks, hadn't read that one! (so I was still at -1 from > http://sweng.the-davies.net/Home/rustys-api-design-manifesto ;-) > > So "pm_runtime_put_noidle()" is the (definitive?) one to pair with a > pm_runtime_get_sync() failure? My biggest worry here is all those copycats jumping on the bandwagon, and sending untested[*] patches that end up calling the wrong function. [*] Several of them turned out to introduce trivial compile warnings, so I now consider all patches authored by the same person as untested. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds