From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751891AbcF0INc (ORCPT ); Mon, 27 Jun 2016 04:13:32 -0400 Received: from mx2.suse.de ([195.135.220.15]:46021 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751385AbcF0INa (ORCPT ); Mon, 27 Jun 2016 04:13:30 -0400 Date: Mon, 27 Jun 2016 10:13:28 +0200 (CEST) From: Jiri Kosina X-X-Sender: jkosina@pobox.suse.cz To: Pavel Machek cc: Torsten Duwe , matz@suse.de, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Disable non-ABI-compliant optimisations for live patching In-Reply-To: <20160626223720.GC21026@amd> Message-ID: References: <20160622142441.GA31609@lst.de> <20160626223720.GC21026@amd> User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 27 Jun 2016, Pavel Machek wrote: > > Live patching, as we use it, deliberately disrupts the fabric of > > compile units; thus all assumptions a compiler can make about the > > control flow may be invalid. As an example, it could analyse that a > > callee does not touch a caller-saved register at all, so why waste > > memory bandwidth saving it? The register allocations for the live > > patch replacement function may however be quite different. > > > > Starting with this example, disable all compiler optimisations that > > do not strictly comply with the established calling conventions. > > I thought that in such case, person creating the live patch should > notice and adjust patch appropriately, at assembly level if > neccessary..? Yes, that still holds; a lot of things could be automated though, and creating the automation tools is one of the big TODO items. > If this is not true, and we want gcc to help us, what other > optimalizations do we need to disable? Even changes inside one compiler > unit can be "interesting"... What would actually be helpful is gcc providing us with a list of functions where it performed this ABI-violating optimization (similarly, we're already obtaining list of "what got inlined where"). Unfortunately, -fdump-ipa-ra is currently missing; I'm talking to gcc guys now to have it implemented. -- Jiri Kosina SUSE Labs