From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750817AbeAOSMl (ORCPT + 1 other); Mon, 15 Jan 2018 13:12:41 -0500 Received: from merlin.infradead.org ([205.233.59.134]:41982 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750718AbeAOSMj (ORCPT ); Mon, 15 Jan 2018 13:12:39 -0500 Date: Mon, 15 Jan 2018 19:12:30 +0100 From: Peter Zijlstra To: Josh Poimboeuf Cc: David Woodhouse , linux-kernel@vger.kernel.org, Dave Hansen , Ashok Raj , Thomas Gleixner , Tim Chen , Andy Lutomirski , Linus Torvalds , Greg KH , Andrea Arcangeli , Andi Kleen , Arjan Van De Ven , Dan Williams , Paolo Bonzini , Jun Nakajima , Asit Mallick , Borislav Petkov Subject: Re: [PATCH 2/4] objtool: Implement jump_assert for _static_cpu_has() Message-ID: <20180115181230.GD2228@hirez.programming.kicks-ass.net> References: <20180115164428.498966552@infradead.org> <20180115164909.836510626@infradead.org> <20180115180405.cdzdgw6tocbsmbrf@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180115180405.cdzdgw6tocbsmbrf@treble> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On Mon, Jan 15, 2018 at 12:04:05PM -0600, Josh Poimboeuf wrote: > On Mon, Jan 15, 2018 at 05:44:30PM +0100, Peter Zijlstra wrote: > > Unlike the jump_label bits, static_cpu_has is implemented with > > alternatives. Sadly it doesn't readily distinguish itself from any > > other alternatives. > > > > Use a heuristic to guess at it :/ > > > > But like jump_labels, make static_cpu_has set br_static on the > > instructions after the static branch such that we can assert on it. > > This seems a bit heavy handed and fragile, though maybe it is the best > way. Still I wonder if there's a better way to do it. > > Some quick ideas: > > a) Somehow use __jump_table in the _static_cpu_has() macro? Can do, but adds permanent overhead for the fake table entries, also the alternative in _static_cpu_has is slightly more complex, but it would work I think. > b) Add another special annotation to tell objtool where > _static_cpu_has() locations are? Almost did that, but I figured I'd give this a try first. But yes I agree it is somewhat ugly.