From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762637AbdALBZp (ORCPT ); Wed, 11 Jan 2017 20:25:45 -0500 Received: from exsmtp01.microchip.com ([198.175.253.37]:48053 "EHLO email.microchip.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1759617AbdALBZo (ORCPT ); Wed, 11 Jan 2017 20:25:44 -0500 From: To: , CC: , , , , , , Subject: RE: [PATCH 1/3] ARM: at91: flush the L2 cache before entering cpu idle Thread-Topic: [PATCH 1/3] ARM: at91: flush the L2 cache before entering cpu idle Thread-Index: AQHSZ+rsMKNieJVdMU6/XbtU2qIHPaEyX9SAgAAJHQCAAIwTYIAApZ+AgAADrYCAAHYTIA== Date: Thu, 12 Jan 2017 01:25:22 +0000 Message-ID: References: <20170106065947.30631-1-wenyou.yang@atmel.com> <20170106065947.30631-2-wenyou.yang@atmel.com> <20170110161821.vp673jyfqx6s76pg@piout.net> <20170111111814.GJ14217@n2100.armlinux.org.uk> In-Reply-To: <20170111111814.GJ14217@n2100.armlinux.org.uk> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.10.76.4] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id v0C1PqNd015169 > -----Original Message----- > From: Russell King - ARM Linux [mailto:linux@armlinux.org.uk] > Sent: 2017年1月11日 19:18 > To: Jean-Jacques Hiblot > Cc: Wenyou Yang - A41535 ; Alexandre Belloni > ; Mark Rutland ; > devicetree ; Nicolas Ferre > ; Linux Kernel Mailing List kernel@vger.kernel.org>; robh+dt ; linux-arm- > kernel@lists.infradead.org > Subject: Re: [PATCH 1/3] ARM: at91: flush the L2 cache before entering cpu idle > > On Wed, Jan 11, 2017 at 12:05:05PM +0100, Jean-Jacques Hiblot wrote: > > 2017-01-11 9:15 GMT+01:00 : > > > Hi Jean-Jacques, > > > > > >> -----Original Message----- > > >> From: Jean-Jacques Hiblot [mailto:jjhiblot@gmail.com] > > >> Sent: 2017年1月11日 0:51 > > >> To: Alexandre Belloni > > >> Cc: Wenyou Yang - A41535 ; Mark Rutland > > >> ; devicetree ; > > >> Russell King ; Wenyou Yang - A41535 > > >> ; Nicolas Ferre > > >> ; Linux Kernel Mailing List > > >> ; Rob Herring ; > > >> linux-arm-kernel@lists.infradead.org > > >> Subject: Re: [PATCH 1/3] ARM: at91: flush the L2 cache before > > >> entering cpu idle > > >> > > >> 2017-01-10 17:18 GMT+01:00 Alexandre Belloni > > >> : > > >> > I though a bit more about it, and I don't really like the new > > >> > compatible string. I don't feel this should be necessary. > > >> > > > >> > What about the following: > > >> > > > >> > diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c > > >> > index > > >> > b4332b727e9c..0333aca63e44 100644 > > >> > --- a/arch/arm/mach-at91/pm.c > > >> > +++ b/arch/arm/mach-at91/pm.c > > >> > @@ -53,6 +53,7 @@ extern void at91_pinctrl_gpio_resume(void); > > >> > static struct { > > >> > unsigned long uhp_udp_mask; > > >> > int memctrl; > > >> > + bool has_l2_cache; > > >> > } at91_pm_data; > > >> > > > >> > void __iomem *at91_ramc_base[2]; @@ -267,6 +268,11 @@ static > > >> > void at91_ddr_standby(void) > > >> > u32 lpr0, lpr1 = 0; > > >> > u32 saved_lpr0, saved_lpr1 = 0; > > >> > > > >> > > >> > + if (at91_pm_data.has_l2_cache) { > > >> > + flush_cache_all(); > > >> what is the point of calling flush_cache_all() here ? Do we really > > >> care that dirty data in L1 is written to DDR ? I may be missing > > >> something but to me it's just extra latency. > > > > > > Are you mean use outer_flush_all() to flush all cache lines in the outer cache > only? > > > > Yes that's what I meant. You see, you don't flush the cache for > > sama5d3 so it shouldn't be required either for sam5d4. You should be > > able to test it quickly and see if L1 flush is indeed required by > > replacing flush_cache_all() with outer_flush_all(). BTW is highly > > probable that L2 cache flush is done in outer_disable() so calling > > outer_flush_all() is probably no required. > > Please don't. Read the comments in the code, and understand the APIs that > you're suggesting people use _before_ making the suggestion: > > /** > * outer_flush_all - clean and invalidate all cache lines in the outer cache > * > * Note: depending on implementation, this may not be atomic - it must > * only be called with interrupts disabled and no other active outer > * cache masters. > * > * It is intended that this function is only used by implementations > * needing to override the outer_cache.disable() method due to security. > * (Some implementations perform this as a clean followed by an invalidate.) */ > > So, outer_flush_all() should not be called except from L2 cache code > implementing the outer_disable() function - it's not intended for platforms to use. > > There are, however, sadly three users of outer_flush_all() which have crept in > through arm-soc, that should be outer_disable() instead. Here, outer_flush_all() should not be called, calling outer_disable() is enough. Is it right? In the implementation of l2c_disable(void) of in mm/cache-l2x0.c, the outer_cache.flush_all() is called. > > -- > RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ > FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up > according to speedtest.net. Best Regards, Wenyou Yang From mboxrd@z Thu Jan 1 00:00:00 1970 From: Subject: RE: [PATCH 1/3] ARM: at91: flush the L2 cache before entering cpu idle Date: Thu, 12 Jan 2017 01:25:22 +0000 Message-ID: References: <20170106065947.30631-1-wenyou.yang@atmel.com> <20170106065947.30631-2-wenyou.yang@atmel.com> <20170110161821.vp673jyfqx6s76pg@piout.net> <20170111111814.GJ14217@n2100.armlinux.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Return-path: In-Reply-To: <20170111111814.GJ14217-l+eeeJia6m9URfEZ8mYm6t73F7V6hmMc@public.gmane.org> Content-Language: en-US Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org, jjhiblot-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org Cc: alexandre.belloni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org, mark.rutland-5wv7dgnIgG8@public.gmane.org, devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org List-Id: devicetree@vger.kernel.org DQoNCj4gLS0tLS1PcmlnaW5hbCBNZXNzYWdlLS0tLS0NCj4gRnJvbTogUnVzc2VsbCBLaW5nIC0g QVJNIExpbnV4IFttYWlsdG86bGludXhAYXJtbGludXgub3JnLnVrXQ0KPiBTZW50OiAyMDE35bm0 MeaciDEx5pelIDE5OjE4DQo+IFRvOiBKZWFuLUphY3F1ZXMgSGlibG90IDxqamhpYmxvdEBnbWFp bC5jb20+DQo+IENjOiBXZW55b3UgWWFuZyAtIEE0MTUzNSA8V2VueW91LllhbmdAbWljcm9jaGlw LmNvbT47IEFsZXhhbmRyZSBCZWxsb25pDQo+IDxhbGV4YW5kcmUuYmVsbG9uaUBmcmVlLWVsZWN0 cm9ucy5jb20+OyBNYXJrIFJ1dGxhbmQgPG1hcmsucnV0bGFuZEBhcm0uY29tPjsNCj4gZGV2aWNl dHJlZSA8ZGV2aWNldHJlZUB2Z2VyLmtlcm5lbC5vcmc+OyBOaWNvbGFzIEZlcnJlDQo+IDxuaWNv bGFzLmZlcnJlQGF0bWVsLmNvbT47IExpbnV4IEtlcm5lbCBNYWlsaW5nIExpc3QgPGxpbnV4LQ0K PiBrZXJuZWxAdmdlci5rZXJuZWwub3JnPjsgcm9iaCtkdCA8cm9iaCtkdEBrZXJuZWwub3JnPjsg bGludXgtYXJtLQ0KPiBrZXJuZWxAbGlzdHMuaW5mcmFkZWFkLm9yZw0KPiBTdWJqZWN0OiBSZTog W1BBVENIIDEvM10gQVJNOiBhdDkxOiBmbHVzaCB0aGUgTDIgY2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ydzIFBhdGNoIHN5c3RlbTogaHR0cDovL3d3dy5hcm1saW51eC5v cmcudWsvZGV2ZWxvcGVyL3BhdGNoZXMvDQo+IEZUVEMgYnJvYWRiYW5kIGZvciAwLjhtaWxlIGxp bmU6IGN1cnJlbnRseSBhdCA5LjZNYnBzIGRvd24gNDAwa2JwcyB1cA0KPiBhY2NvcmRpbmcgdG8g c3BlZWR0ZXN0Lm5ldC4NCg0KDQpCZXN0IFJlZ2FyZHMsDQpXZW55b3UgWWFuZw0K -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wenyou.Yang@microchip.com (Wenyou.Yang at microchip.com) Date: Thu, 12 Jan 2017 01:25:22 +0000 Subject: [PATCH 1/3] ARM: at91: flush the L2 cache before entering cpu idle In-Reply-To: <20170111111814.GJ14217@n2100.armlinux.org.uk> References: <20170106065947.30631-1-wenyou.yang@atmel.com> <20170106065947.30631-2-wenyou.yang@atmel.com> <20170110161821.vp673jyfqx6s76pg@piout.net> <20170111111814.GJ14217@n2100.armlinux.org.uk> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org > -----Original Message----- > From: Russell King - ARM Linux [mailto:linux at armlinux.org.uk] > Sent: 2017?1?11? 19:18 > To: Jean-Jacques Hiblot > Cc: Wenyou Yang - A41535 ; Alexandre Belloni > ; Mark Rutland ; > devicetree ; Nicolas Ferre > ; Linux Kernel Mailing List kernel at vger.kernel.org>; robh+dt ; linux-arm- > kernel at lists.infradead.org > Subject: Re: [PATCH 1/3] ARM: at91: flush the L2 cache before entering cpu idle > > On Wed, Jan 11, 2017 at 12:05:05PM +0100, Jean-Jacques Hiblot wrote: > > 2017-01-11 9:15 GMT+01:00 : > > > Hi Jean-Jacques, > > > > > >> -----Original Message----- > > >> From: Jean-Jacques Hiblot [mailto:jjhiblot at gmail.com] > > >> Sent: 2017?1?11? 0:51 > > >> To: Alexandre Belloni > > >> Cc: Wenyou Yang - A41535 ; Mark Rutland > > >> ; devicetree ; > > >> Russell King ; Wenyou Yang - A41535 > > >> ; Nicolas Ferre > > >> ; Linux Kernel Mailing List > > >> ; Rob Herring ; > > >> linux-arm-kernel at lists.infradead.org > > >> Subject: Re: [PATCH 1/3] ARM: at91: flush the L2 cache before > > >> entering cpu idle > > >> > > >> 2017-01-10 17:18 GMT+01:00 Alexandre Belloni > > >> : > > >> > I though a bit more about it, and I don't really like the new > > >> > compatible string. I don't feel this should be necessary. > > >> > > > >> > What about the following: > > >> > > > >> > diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c > > >> > index > > >> > b4332b727e9c..0333aca63e44 100644 > > >> > --- a/arch/arm/mach-at91/pm.c > > >> > +++ b/arch/arm/mach-at91/pm.c > > >> > @@ -53,6 +53,7 @@ extern void at91_pinctrl_gpio_resume(void); > > >> > static struct { > > >> > unsigned long uhp_udp_mask; > > >> > int memctrl; > > >> > + bool has_l2_cache; > > >> > } at91_pm_data; > > >> > > > >> > void __iomem *at91_ramc_base[2]; @@ -267,6 +268,11 @@ static > > >> > void at91_ddr_standby(void) > > >> > u32 lpr0, lpr1 = 0; > > >> > u32 saved_lpr0, saved_lpr1 = 0; > > >> > > > >> > > >> > + if (at91_pm_data.has_l2_cache) { > > >> > + flush_cache_all(); > > >> what is the point of calling flush_cache_all() here ? Do we really > > >> care that dirty data in L1 is written to DDR ? I may be missing > > >> something but to me it's just extra latency. > > > > > > Are you mean use outer_flush_all() to flush all cache lines in the outer cache > only? > > > > Yes that's what I meant. You see, you don't flush the cache for > > sama5d3 so it shouldn't be required either for sam5d4. You should be > > able to test it quickly and see if L1 flush is indeed required by > > replacing flush_cache_all() with outer_flush_all(). BTW is highly > > probable that L2 cache flush is done in outer_disable() so calling > > outer_flush_all() is probably no required. > > Please don't. Read the comments in the code, and understand the APIs that > you're suggesting people use _before_ making the suggestion: > > /** > * outer_flush_all - clean and invalidate all cache lines in the outer cache > * > * Note: depending on implementation, this may not be atomic - it must > * only be called with interrupts disabled and no other active outer > * cache masters. > * > * It is intended that this function is only used by implementations > * needing to override the outer_cache.disable() method due to security. > * (Some implementations perform this as a clean followed by an invalidate.) */ > > So, outer_flush_all() should not be called except from L2 cache code > implementing the outer_disable() function - it's not intended for platforms to use. > > There are, however, sadly three users of outer_flush_all() which have crept in > through arm-soc, that should be outer_disable() instead. Here, outer_flush_all() should not be called, calling outer_disable() is enough. Is it right? In the implementation of l2c_disable(void) of in mm/cache-l2x0.c, the outer_cache.flush_all() is called. > > -- > RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ > FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up > according to speedtest.net. Best Regards, Wenyou Yang