Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1093512imm; Tue, 3 Jul 2018 05:31:09 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKXAsm1CSk6aUsC7JrU16Y9soSDOJmf6UQll8F3aJ3zF67BfITpHtV6UIt8BtoxKJXObqr1 X-Received: by 2002:a17:902:5588:: with SMTP id g8-v6mr29263467pli.99.1530621069111; Tue, 03 Jul 2018 05:31:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530621069; cv=none; d=google.com; s=arc-20160816; b=b8ahHRhzBoOfYQkWR7oFxVq5Qfigakvu3BbaUCzunPv7xAjFGzDAZxLrZ9kqqy/x18 BFAgasWaQx08T8sFQ8rmN5AoluR/JoppYP3JllagikXRKJ3RicyKZF6KCccnLjNKXD6x 02fwBCTovuA+AHSc9Ui0uaJ/sR6PJHj1SJY3+oKI985GU9CbG/XoD5uWOhiyNuRzXOzc v5VKk7HWEDn+MQICjQxTN7rjBFzoukLEfcRtvk6INwnJV/HJlUZVZbhR0BexZ1tqtjxB 3mKS46AQPPlEAl5ilmzEjmnLg3CmJRO3rAHC6DdVDA6SdDiNbsdnZMN0R9XzIz8Ko9h1 Jzhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:in-reply-to :mime-version:user-agent:date:message-id:from:cc:references:to :subject:arc-authentication-results; bh=GKNiTd51NEdLj/rw+kLKrwNCcyon0+VRRg5/3iifdyA=; b=izQ8PHQU1GOFzWWZwSjgE6km9nWL1GMn7wDmlabLnWWoxG94dKUvgBVs1MxglFEh1c HZMVWM6zAbw1c11spItDVzBhUp1uvqOMI0ZrVZaNooqib2YoHL8pPIXHNEhZ6fszvFNa PaCk3UNR8++HhVKArY2OEt0t9vlGHhx21RzvSly14re4kwGl/JCh+YtGAS8j1NeeIlPA be/ijp2lBibFlGFL5g/sC235BgRmQnoBLZo0EtuiSxrmnUgkKLccfSQbJTBR9qMKImlO hoqeB7me39Vs0fkze2DF6cMHR5t/8MWBqwSFMMCcI9xZkQwRuYYPRB2v7uJEURi0EKYh RNOw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 62-v6si1061538pfg.224.2018.07.03.05.30.54; Tue, 03 Jul 2018 05:31: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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753048AbeGCMaQ (ORCPT + 99 others); Tue, 3 Jul 2018 08:30:16 -0400 Received: from relay1.mentorg.com ([192.94.38.131]:50392 "EHLO relay1.mentorg.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752686AbeGCMaP (ORCPT ); Tue, 3 Jul 2018 08:30:15 -0400 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-04.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1faKRh-0002fb-LL from Vladimir_Zapolskiy@mentor.com ; Tue, 03 Jul 2018 05:30:13 -0700 Received: from [137.202.108.125] (137.202.0.87) by SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Tue, 3 Jul 2018 13:30:09 +0100 Subject: Re: [PATCH 2/2] misc: sram: enable clock before registering regions To: Johan Hovold References: <20180703100548.30214-1-johan@kernel.org> <20180703100548.30214-2-johan@kernel.org> <20180703114703.GO9802@localhost> CC: Greg Kroah-Hartman , Arnd Bergmann , Alexandre Belloni , From: Vladimir Zapolskiy Message-ID: <82483d77-500c-e2dd-00ed-79cc842f5371@mentor.com> Date: Tue, 3 Jul 2018 15:30:09 +0300 User-Agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Icedove/45.2.0 MIME-Version: 1.0 In-Reply-To: <20180703114703.GO9802@localhost> Content-Type: text/plain; charset="windows-1252" Content-Transfer-Encoding: 7bit X-Originating-IP: [137.202.0.87] X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/03/2018 02:47 PM, Johan Hovold wrote: > On Tue, Jul 03, 2018 at 01:23:30PM +0300, Vladimir Zapolskiy wrote: >> Hi Johan, >> >> On 07/03/2018 01:05 PM, Johan Hovold wrote: >>> Make sure to enable the clock before registering regions and exporting >>> partitions to user space at which point we must be prepared for I/O. >>> >>> Fixes: ee895ccdf776 ("misc: sram: fix enabled clock leak on error path") >>> Cc: Vladimir Zapolskiy >>> Signed-off-by: Johan Hovold >> >> thank you for the change, however please note that the identified commit >> for the fix is incorrect one apparently. >> >> In my opinion the proper tag contents would be >> >> Fixes: b4c3fcb3c71f ("misc: sram: extend usage of reserved partitions") >> >> I hope you agree to it, also I would suggest to swap the changes in >> the series. > > No, I think I used the right commit in the Fixes tag as that was the > commit which moved the clock enable to after the memory-region > registration (at which point the memory could potentially be accessed). I was confused by the moved sram_reserve_regions() call, which was added way later. Allright, if it is assumed that gen_pool_get() interface requires only a registered memory pool provider device, and it does, then there is another kind of a problem, a SRAM/genpool consumer may not get access to a valid region in SRAM before the latter is added to the SRAM pool in sram_probe(). Instantly I don't know how to solve the issue above, it may require a change to lib/genalloc.c to request a registration of genpool device driver, but then such a change solves the problem identified by you as well. For your change as a proper (partial?) fix: Reviewed-by: Vladimir Zapolskiy -- Best wishes, Vladimir