Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752344Ab3EPERI (ORCPT ); Thu, 16 May 2013 00:17:08 -0400 Received: from wolverine02.qualcomm.com ([199.106.114.251]:15278 "EHLO wolverine02.qualcomm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751244Ab3EPERE (ORCPT ); Thu, 16 May 2013 00:17:04 -0400 X-IronPort-AV: E=Sophos;i="4.87,681,1363158000"; d="scan'208";a="47795823" Message-ID: <51945DBF.60308@codeaurora.org> Date: Wed, 15 May 2013 21:17:03 -0700 From: Saravana Kannan User-Agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: Ulf Hansson CC: linux-arm-kernel@lists.infradead.org, Mike Turquette , Paul Walmsley , Shawn Guo , Sascha Hauer , Rob Herring , Mark Brown , Russell King , linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Andrew Lunn , Jeremy Kerr , Thomas Gleixner , Arnd Bergman , Jamie Iles , Richard Zhao , Magnus Damm , Linus Walleij , Stephen Boyd , Amit Kucheria , Deepak Saxena , Grant Likely , Tomasz Figa Subject: Re: [PATCH] clk: Fix race condition between clk_set_parent and clk_enable() References: <1367383328-25700-1-git-send-email-skannan@codeaurora.org> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1731 Lines: 52 On 05/15/2013 12:24 PM, Ulf Hansson wrote: > On 1 May 2013 06:42, Saravana Kannan wrote: >> - /* migrate prepare */ >> - if (clk->prepare_count) >> + /* >> + * Migrate prepare state between parents and prevent race with >> + * clk_enable(). >> + * >> + * If the clock is not prepared, then a race with >> + * clk_enable/disable() is impossible since we already have the >> + * prepare lock (future calls to clk_enable() need to be preceded by >> + * a clk_prepare()). >> + * >> + * If the clock is prepared, migrate the prepared state to the new >> + * parent and also protect against a race with clk_enable() by >> + * forcing the clock and the new parent on. This ensures that all >> + * future calls to clk_enable() are practically NOPs with respect to >> + * hardware and software states. >> + */ > > Maybe an additional note about that since CLK_SET_PARENT_GATE is a > prerequisite for doing migration of "prepare", we also interpreted > this flags as it is acceptable to enable the clock(s) in this context. Done. Sent v2 patch. > > Looks good! Thanks for having another round to fixup this kind of > tricky code. :-) Thanks :-) > Acked-by: Ulf Hansson > Thanks again. -Saravana -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/