Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4995124rwb; Mon, 31 Jul 2023 16:19:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlHJ5YE7oqsO/erJxY1SwXKtyxjHMBzYYJq0F/2UoWWP7w1mii4LBByM+UuoiduFQXO2mHb1 X-Received: by 2002:a05:6a20:7493:b0:137:30db:bc35 with SMTP id p19-20020a056a20749300b0013730dbbc35mr12152517pzd.27.1690845568268; Mon, 31 Jul 2023 16:19:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690845568; cv=none; d=google.com; s=arc-20160816; b=sx+oAhKajwm7tubE4BPBavt03t78QnxKhDEIQQoC0cpiGEX3C3RFsDPTdslwbPq+FJ JP0lJJWEMEjpG09UBtxsTiiVV6NDQ7+iqsyWipKA3aMwz+KjbwToxa5dUjtw5miN3z/O CvO5BC/ZMwTPR3F9l7ytrewq0lM/mPtOiLXNcj2rw841ZpRwFdRyTzwwifvcxnePvmik lBch10kuN3aM67jsI+2LrXYrXrfIGZFYlP9NrlBEi29hG5Y8S8dxeuPXz/RaJ/l0wi7o GJf3U1AQjKQwMVaMuSQQWsfqIVQ+20AIjjHkSk92TC9eFWn5P5WSjdm60Tnbz/hviFJk QUKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=vTIB+9jOZpp5OUrJxulSYIOZhA9Dpc6dGOGdH6SgMUw=; fh=lawFj9i2/XML876B3JRASmc3m5GX5ymWaE2XbnWkK9s=; b=FOTEdjDC15BzhvdjP4JTzCcBeMDHJVLPND1obcDzNrBPJI8uVpDrQwbSnSez4nl4i3 /NZICZCL5JbkCshAG6N174R75PzihIMRCMQAd9AZHDfsgrZoK+8c3DtO9LRHei+IqZ/X JqlbvmWC7yEqmbcM3abGnqslHMnd98R8FugSoF6NhcifcICSJQH/hslVeqc56JQClAON 2JszpuHl84RQZMsdkPAn+XciqcChMRi6r6GTf0WX6ZqekLYF77XPo58+OQMDr68P7AoS yrJ14rImaHci6tS6H7Cl9HU9EII+SIUbHByusXCxV4Sae9uxO7lJlHvhgUtXdy4WFMXK jFeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=CztjLyfq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s1-20020a63dc01000000b00563de041d41si6218577pgg.15.2023.07.31.16.19.16; Mon, 31 Jul 2023 16:19:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=CztjLyfq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231426AbjGaVqX (ORCPT + 99 others); Mon, 31 Jul 2023 17:46:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229486AbjGaVqV (ORCPT ); Mon, 31 Jul 2023 17:46:21 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 747AB130; Mon, 31 Jul 2023 14:46:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=vTIB+9jOZpp5OUrJxulSYIOZhA9Dpc6dGOGdH6SgMUw=; b=CztjLyfqcdrFKznDsLQyVMumAI MN3Xna4qhxwpkV4FiIedm9yhrd8/l9X3R1rELIM6w6jiAUYNvsWeUNfNX0kRxnWuibkdN56xgYU3F WqI7lUf1lNSIxS51cJCvE4zW3pDRLHuMSlh2ESprJKMTkPFNV+FTAdXNCdTAMqBOQJeRw+5TDcwPk WLl4wnTsMUR97Exiyc0+o18OmIW+qTmQmfo7V4o+svym0ooDszJ6obRAKyK/Cz9rCAlkte3H+V4xv TjvBifgNXlOtGpzS09pMJuV8fsPGfHcZH+mMOCpPjhyJY51SrujtQrMqBzVhk2Ji3cQ0Vp4WSlYXg X1xkQqJQ==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qQaiU-00D67l-29; Mon, 31 Jul 2023 21:46:15 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 9831D300134; Mon, 31 Jul 2023 23:46:12 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7BAE620D70602; Mon, 31 Jul 2023 23:46:12 +0200 (CEST) Date: Mon, 31 Jul 2023 23:46:12 +0200 From: Peter Zijlstra To: Josh Poimboeuf Cc: Valentin Schneider , linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kvm@vger.kernel.org, linux-mm@kvack.org, bpf@vger.kernel.org, x86@kernel.org, rcu@vger.kernel.org, linux-kselftest@vger.kernel.org, Steven Rostedt , Masami Hiramatsu , Jonathan Corbet , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , "H. Peter Anvin" , Paolo Bonzini , Wanpeng Li , Vitaly Kuznetsov , Andy Lutomirski , Frederic Weisbecker , "Paul E. McKenney" , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Andrew Morton , Uladzislau Rezki , Christoph Hellwig , Lorenzo Stoakes , Jason Baron , Kees Cook , Sami Tolvanen , Ard Biesheuvel , Nicholas Piggin , Juerg Haefliger , Nicolas Saenz Julienne , "Kirill A. Shutemov" , Nadav Amit , Dan Carpenter , Chuang Wang , Yang Jihong , Petr Mladek , "Jason A. Donenfeld" , Song Liu , Julian Pidancet , Tom Lendacky , Dionna Glaze , Thomas =?iso-8859-1?Q?Wei=DFschuh?= , Juri Lelli , Daniel Bristot de Oliveira , Marcelo Tosatti , Yair Podemsky Subject: Re: [RFC PATCH v2 11/20] objtool: Flesh out warning related to pv_ops[] calls Message-ID: <20230731214612.GC51835@hirez.programming.kicks-ass.net> References: <20230720163056.2564824-1-vschneid@redhat.com> <20230720163056.2564824-12-vschneid@redhat.com> <20230728153334.myvh5sxppvjzd3oz@treble> <20230731213631.pywytiwdqgtgx4ps@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230731213631.pywytiwdqgtgx4ps@treble> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 31, 2023 at 04:36:31PM -0500, Josh Poimboeuf wrote: > On Mon, Jul 31, 2023 at 12:16:59PM +0100, Valentin Schneider wrote: > > You're quite right - fabricating an artificial warning with a call to __flush_tlb_local(): > > > > vmlinux.o: warning: objtool: pv_ops[1]: indirect call to native_flush_tlb_local() leaves .noinstr.text section > > vmlinux.o: warning: objtool: __flush_tlb_all_noinstr+0x4: call to {dynamic}() leaves .noinstr.text section > > > > Interestingly the second one doesn't seem to have triggered the "pv_ops" > > bit of call_dest_name. Seems like any call to insn_reloc(NULL, x) will > > return NULL. > > Yeah, that's weird. > > > Trickling down the file yields: > > > > vmlinux.o: warning: objtool: pv_ops[1]: indirect call to native_flush_tlb_local() leaves .noinstr.text section > > vmlinux.o: warning: objtool: __flush_tlb_all_noinstr+0x4: call to pv_ops[0]() leaves .noinstr.text section > > > > In my case (!PARAVIRT_XXL) pv_ops should look like: > > [0]: .cpu.io_delay > > [1]: .mmu.flush_tlb_user() > > > > so pv_ops[1] looks right. Seems like pv_call_dest() gets it right because > > it uses arch_dest_reloc_offset(). > > > > If I use the above to fix up validate_call(), would we still need > > pv_call_dest() & co? > > The functionality in pv_call_dest() is still needed because it goes > through all the possible targets for the .mmu.flush_tlb_user() pointer > -- xen_flush_tlb() and native_flush_tlb_local() -- and makes sure > they're noinstr. > > Ideally it would only print a single warning for this case, something > like: > > vmlinux.o: warning: objtool: __flush_tlb_all_noinstr+0x4: indirect call to native_flush_tlb_local() leaves .noinstr.text section But then what for the case where there are multiple implementations and more than one isn't noinstr? IIRC that is where these double prints came from. One is the callsite (always one) and the second is the offending implementation (but there could be more). > I left out "pv_ops[1]" because it's already long enough :-) The index number is useful when also looking at the assembler, which IIRC is an indexed indirect call.