Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1506721
| Path | csiph.com!1.us.feeder.erje.net!2.us.feeder.erje.net!feeder.erje.net!2.eu.feeder.erje.net!newsreader4.netcologne.de!news.netcologne.de!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Bryan O'Donoghue <pure.logic@nexus-software.ie> |
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH v3 1/1] x86/platform/intel-mid: Retrofit pci_platform_pm_ops ->get_state hook |
| Date | Sun, 23 Oct 2016 18:20:01 +0200 |
| Message-ID | <svtF7-3ep-7@gated-at.bofh.it> (permalink) |
| References | <svpBv-q6-9@gated-at.bofh.it> <svpBv-q6-7@gated-at.bofh.it> <svqed-Xq-9@gated-at.bofh.it> <svspI-2hg-11@gated-at.bofh.it> |
| X-Original-To | Lukas Wunner <lukas@wunner.de> |
| Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=nexus-software-ie.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :mime-version:content-transfer-encoding; bh=SWSv1aB3kHvfBGVX3Ole0Ovi5j5DH/mTGuSpvqtoGBs=; b=hzMrvlhweiU6GQuJj613Vrmswf70gLpH1NuqzsqRvffqA/DhiJOZ5RrilvOLb39R6F flOma9vmle7WsxIE3amUWyH5DC76POfwVY5/WYyOMSFtJB9EO1LH+72rXhKN2zYK4Fyt aPkvTTyYJz8HmVlfn+zIkyZZSYXgdhUAWLN5NE2LLysNL3Hw4yB3b7MhQFWJ0jEeVG4r l7+W/BK4Umz49NXESxWDOyAxiJLFgTLKGz/j5ucQaihG1SZuRwtZ9C6RxfVN45pq1cMX /MVe8UBsP6zatbo2z7mW9//q2YQy/FEczwmltl2jdhTt8JmWBpbWRWQ+WT3fmRDgivpv lbfg== |
| X-Google-Dkim-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:mime-version:content-transfer-encoding; bh=SWSv1aB3kHvfBGVX3Ole0Ovi5j5DH/mTGuSpvqtoGBs=; b=BwytcjSFrziigvyn12zaSzYoKks/A/Q34/IVtiEwTyg9mDb33C9XBiQt9Of4yahltg 6f+mqRw/NwH/wushSgBSAWI7GKWRwgW5V8f0GSn/qwaYu37YcT1i58LgnyJK8Ke1Kgs7 Vm47kAko+aHMx5lo44Or2/2cR13frhzspH10jlY763Fdonqf48spIatu5SUTSiNBy2wR MF5EPrnC0X4WYZ288hGUkNcueFmqwTMSQsr78y7vDfM7JfftfFYXjf6+NlQABcBDMIkP UkvO/UmGDYmeqvleUN7ZRgfCdELGqhK4ZzR7XyB9elrOciF4GRLej3K1/he6V2hnk/Fl hEkA== |
| X-Gm-Message-State | ABUngvdUufDHNSHpu3hRQgJHoWAVzl91tF+ncYQSjd0P2t/MvhUO14O7VR50/A4nv22SRQ== |
| X-Received | by 10.194.202.195 with SMTP id kk3mr8154563wjc.37.1477239533415; Sun, 23 Oct 2016 09:18:53 -0700 (PDT) |
| Content-Type | text/plain; charset="UTF-8" |
| X-Mailer | Evolution 3.18.5.2-0ubuntu3 |
| MIME-Version | 1.0 |
| Content-Transfer-Encoding | 8bit |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 68 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Ingo Molnar <mingo@kernel.org>, x86@kernel.org, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Bjorn Helgaas <bhelgaas@google.com>, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org |
| X-Original-Date | Sun, 23 Oct 2016 17:25:52 +0100 |
| X-Original-Message-ID | <1477239952.25812.11.camel@nexus-software.ie> |
| X-Original-References | <cover.1477221514.git.lukas@wunner.de> <7c1567d4c49303a4aada94ba16275cbf56b8976b.1477221514.git.lukas@wunner.de> <1477226275.2932.54.camel@nexus-software.ie> <20161023145757.GA4909@wunner.de> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1506721 |
Show key headers only | View raw
On Sun, 2016-10-23 at 16:57 +0200, Lukas Wunner wrote:
> On Sun, Oct 23, 2016 at 01:37:55PM +0100, Bryan O'Donoghue wrote:
> >
> The usage of a mutex in mid_pwr_set_power_state() actually seems
> questionable since this is called with interrupts disabled:
> pci_pm_resume_noirq
> pci_pm_default_resume_early
> pci_power_up
> platform_pci_set_power_state
> mid_pci_set_power_state
> intel_mid_pci_set_power_state
> mid_pwr_set_power_state
That was my other question then - though I assume the mutex is put in
place to future-proof the code.
I'm just wondering out loud - considering we have the case where we update a register and then spin waiting for a command completion - is it in fact logically valid to have a concurrent reader read out the power state - when another writer is executing mid_pwr_wait() - for example.
/* Wait 500ms that the latest PWRMU command finished */
static int mid_pwr_wait(struct mid_pwr *pwr)
{
unsigned int count = 500000;
bool busy;
do {
busy = mid_pwr_is_busy(pwr);
if (!busy)
return 0;
udelay(1);
} while (--count);
return -EBUSY;
}
static int mid_pwr_wait_for_cmd(struct mid_pwr *pwr, u8 cmd)
{
writel(PM_CMD_CMD(cmd) | PM_CMD_CM_IMMEDIATE, pwr->regs +
PM_CMD);
return mid_pwr_wait(pwr);
}
static int __update_power_state(struct mid_pwr *pwr, int reg, int bit,
int new)
{
<snip>
/* Update the power state */
mid_pwr_set_state(pwr, reg, (power & ~(3 << bit)) | (new <<
bit));
/* Send command to SCU */
ret = mid_pwr_wait_for_cmd(pwr, CMD_SET_CFG);
if (ret)
return ret;
<snip>
}
anyway...
I've tested your patch and it looks good. We can otherwise defer to
andy on the usage of the mutex.
Tested-by: Bryan O'Donoghue <pure.logic@nexus-software.ie>
---
bod
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH v3 0/1] x86/platform/intel-mid: Retrofit pci_platform_pm_ops Lukas Wunner <lukas@wunner.de> - 2016-10-23 14:00 +0200
[PATCH v3 1/1] x86/platform/intel-mid: Retrofit pci_platform_pm_ops ->get_state hook Lukas Wunner <lukas@wunner.de> - 2016-10-23 14:00 +0200
Re: [PATCH v3 1/1] x86/platform/intel-mid: Retrofit pci_platform_pm_ops ->get_state hook Bryan O'Donoghue <pure.logic@nexus-software.ie> - 2016-10-23 14:40 +0200
Re: [PATCH v3 1/1] x86/platform/intel-mid: Retrofit pci_platform_pm_ops ->get_state hook Lukas Wunner <lukas@wunner.de> - 2016-10-23 17:00 +0200
Re: [PATCH v3 1/1] x86/platform/intel-mid: Retrofit pci_platform_pm_ops ->get_state hook Bryan O'Donoghue <pure.logic@nexus-software.ie> - 2016-10-23 18:20 +0200
Re: [PATCH v3 1/1] x86/platform/intel-mid: Retrofit pci_platform_pm_ops ->get_state hook Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-10-24 11:20 +0200
Re: [PATCH v3 1/1] x86/platform/intel-mid: Retrofit pci_platform_pm_ops ->get_state hook Lukas Wunner <lukas@wunner.de> - 2016-10-24 12:10 +0200
Re: [PATCH v3 1/1] x86/platform/intel-mid: Retrofit pci_platform_pm_ops ->get_state hook Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-10-24 13:10 +0200
Re: [PATCH v3 1/1] x86/platform/intel-mid: Retrofit pci_platform_pm_ops ->get_state hook Lukas Wunner <lukas@wunner.de> - 2016-10-25 08:20 +0200
Re: [PATCH v3 1/1] x86/platform/intel-mid: Retrofit pci_platform_pm_ops ->get_state hook Bryan O'Donoghue <pure.logic@nexus-software.ie> - 2016-10-26 16:00 +0200
Re: [PATCH v3 1/1] x86/platform/intel-mid: Retrofit pci_platform_pm_ops ->get_state hook Andy Shevchenko <andriy.shevchenko@linux.intel.com> - 2016-10-26 17:10 +0200
csiph-web