Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1502288ybb; Thu, 2 Apr 2020 01:58:47 -0700 (PDT) X-Google-Smtp-Source: APiQypIT8oOc1iemBVL1lG5ihMpSBbb8ikniGr3MTpUipeLwGNE7MosGDkODFH+UqkBjxhMDRwsJ X-Received: by 2002:a54:4711:: with SMTP id k17mr1485400oik.104.1585817926956; Thu, 02 Apr 2020 01:58:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585817926; cv=none; d=google.com; s=arc-20160816; b=tsfMQm/+2GJ66IHPpESibpWohmtvlzfI6G3l0H0S6g3I2id6SqnH7nqAiiA5xgxOga nd3QAyCe/cwIMjjNAnGlGZujU759vwetg7cHsFCWoufXSk1uOjrPe/EQQ7vzP3ubPNfl vyM8NRerwC4OoE9pEmOub1/y2NzM5GuD8m+DZyahihM2SOYqzpjZmXgFz27kYVLngrAi nX57IqYGB8PEudabQkokYsIl1oyzi9YVuY11h9wC1KCxyWO9ZGnaXZdYbbI1v/n50vs3 fGS2b77TgGs5OV+Tm6wZQIDT1cJUor36gS286v8NKPw/shL6Il5LAqn2xFzaDLAig0uO Es6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=jiFcykhAheUCHoHvppIvV9ZHqVPV6NNf9M5e+SR4UoA=; b=tZj+BgaT2qx9xt80AdW2u8K6Y1vHchm0fhGVbmh7KHUaXIwnN+ZJPstRmZueT1I7da EmKnMM6neLEJX6G++6Tp2uk9RwXjKKG1THjBGDwA1B+Vdgb8+Vaf+UNlBOvJIfUg0Acz l9gcUfC6b3qkfLl6jRlEww5NQ+MyH5RC+0jMN9uGlG8K3fcCMUVDzKaUB7CgTFZF+6MZ KjE0DOdmhy4JNJig2KkUPcMBMBSMwQX6ccTVjqpShVGnzMTn+hGUgEV5zEzHTd3y2dCx smPyniV/tvPSZLRa0r3M1brtcjAaI7q27jWlcRvG/JZOTPS5FYlbWYWoSUdX+HqfZ18f 6+Uw== 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 e14si2450781otf.226.2020.04.02.01.58.34; Thu, 02 Apr 2020 01:58:46 -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 S2387880AbgDBI6K (ORCPT + 99 others); Thu, 2 Apr 2020 04:58:10 -0400 Received: from mx2.suse.de ([195.135.220.15]:59382 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387780AbgDBI6J (ORCPT ); Thu, 2 Apr 2020 04:58:09 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1CA9AAA55; Thu, 2 Apr 2020 08:58:07 +0000 (UTC) Date: Thu, 2 Apr 2020 10:58:07 +0200 (CEST) From: Miroslav Benes To: Julien Thierry cc: Peter Zijlstra , Josh Poimboeuf , tglx@linutronix.de, linux-kernel@vger.kernel.org, x86@kernel.org, mhiramat@kernel.org, Steven Rostedt Subject: Re: [PATCH v2] objtool,ftrace: Implement UNWIND_HINT_RET_OFFSET In-Reply-To: <0a750745-b069-9ef2-61d3-a15b8fecb649@redhat.com> Message-ID: References: <20200331111652.GH20760@hirez.programming.kicks-ass.net> <20200331202315.zialorhlxmml6ec7@treble> <20200331204047.GF2452@worktop.programming.kicks-ass.net> <20200331211755.pb7f3wa6oxzjnswc@treble> <20200331212040.7lrzmj7tbbx2jgrj@treble> <20200331222703.GH2452@worktop.programming.kicks-ass.net> <20200401170910.GX20730@hirez.programming.kicks-ass.net> <684d6e29-4a01-b4a5-f906-7bdee5ad108f@redhat.com> <20200402075036.GA20730@hirez.programming.kicks-ass.net> <20200402081710.GJ20760@hirez.programming.kicks-ass.net> <0a750745-b069-9ef2-61d3-a15b8fecb649@redhat.com> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2 Apr 2020, Julien Thierry wrote: > > > On 4/2/20 9:17 AM, Peter Zijlstra wrote: > > On Thu, Apr 02, 2020 at 09:50:36AM +0200, Peter Zijlstra wrote: > >> On Thu, Apr 02, 2020 at 07:41:46AM +0100, Julien Thierry wrote: > > > >>> Also, instead of adding a special "arch_exception_frame_size", I could > >>> suggest: > >>> - Picking this patch [1] from a completely arbitrary source > >>> - Getting rid of INSN_STACK type, any instruction could then include stack > >>> ops on top of their existing semantics, they can just have an empty list > >>> if > >>> they don't touch SP/BP > >>> - x86 decoder adds a stack_op to the iret to modify the stack pointer by > >>> the > >>> right amount > >> > >> That's not the worst idea, lemme try that. > > > > Something like so then? > > > > Yes, you could even remove INSN_STACK from insn_type and just always call > handle_insn_ops() before the switch statement on insn->type. If the list is > empty it does nothing. > This way you wouldn't need to call it for the INSN_EXCEPTION_RETURN case, and > any type of instructions could use stack_ops. > > > And the other suggestion is my other email was that you don't even need to add > INSN_EXCEPTION_RETURN. You can keep IRET as INSN_CONTEXT_SWITCH by default and > x86 decoder lookups the symbol conaining an iret. If it's a function symbol, > it can just set the type to INSN_OTHER so that it caries on to the next > instruction after having handled the stack_op. > > And everything fits under tools/objtool/arch/x86 :) . > > Or is it too far-fetch'd? Imho no. Well, it depends. I can see benefits of both approach. PeterZ's patch is quite minimal and it demonstrates itself as a one-off hack quite well. On the other hand, it is in a generic code, which is not nice especially when other archs do not have such thing. So your proposal would indeed make sense to hide it in arch-specific code. Especially for the future. And INSN_STACK is not used much in the code, so it can be removed easily as you proposed. And going more in direction of supporting more archs in the future, I'd say it would make sense to allow more generic things such as "forget about INSN_STACK. If an instruction has non-empty stack_ops list, just process it". It is definitely more flexible. So yes, I think it make sense unless I am missing something. Miroslav