Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp4920640rwb; Mon, 31 Jul 2023 14:48:42 -0700 (PDT) X-Google-Smtp-Source: APBJJlEAqy9Z6CpbNr35UYzrFPtfxragQuLxQgJJBoSc2KdA8N6bVigmfbWZ44KM8qG9VwV6rcBi X-Received: by 2002:a17:907:a078:b0:99b:c949:5efa with SMTP id ia24-20020a170907a07800b0099bc9495efamr852678ejc.2.1690840122510; Mon, 31 Jul 2023 14:48:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690840122; cv=none; d=google.com; s=arc-20160816; b=gKIA8TquO9QIOIuurdnWW5YFDVg/+UbA/mkIVIRXBvCYjZvm56HqZZ3o578di7yGXS ZqEh8J0+POYKzBcCCdp680SJ4Wx1O7IoM/eLIFoWhpouj8JrMCQq7E/o1CgFLnDzmtFy ltyR/RCLHaOVZTJ5qCsSkPel6/lc7AC1L26W699t6Ab74j20uIGEbrsP3fqTDZ7Shq1P FU3TTKn71kMBuU0eKdQd+y4EbpgtCg7DMqzKtltTBnEcvBu11niNgNertlonhbRihO/k iLSuc42XVnK9+n7ZJu0FHFnTnrp3Z3MvtnY9ll+wck2i0pGtMebksTbrJ5SM+9JS06Hc 0Cxw== 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=MB6GONowYHPFofXNJmQAy1cMKKAheLnXFZUuE59nkFc=; fh=ssCX1sjd5qt88BaR0yRNXggTpiVPA/EDtQ2IicSMeXY=; b=xJ1Lv7qW9sHpBXm6cjpxCh9TsKTehfZ+jFJyhR5l9OQpWCRpCKJvjrjV5Jdz0D1Tgs O+9GwBlUYJdyfXPCAeacVk6RPCUu+wngMkcuWq753Tk8JmoAvLQl6tZbOAcGUjYSAknv Ib4TBh7Fyz620N0dl1f0hpcAK/ALGXHiJtmSfXrntgQDyUHxfJEhcpQXyI4ig3UBkWh2 6AGSD/0OVCxsMI2u8wZk+Tx4MIvXcn5ota67vFu6gicgzzE2R0SI8VWwum41MBxRatO2 jq2ZF5iqGoQi6lUqRQzeNaimHRUVlo7sg/E+TrfhUB6ypJ4ZfD+Tip1NlO5PyvhEpOi0 E6dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MEMWPQTN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id rk21-20020a170907215500b0098902d18096si6367317ejb.244.2023.07.31.14.48.16; Mon, 31 Jul 2023 14:48:42 -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=@kernel.org header.s=k20201202 header.b=MEMWPQTN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230008AbjGaVhB (ORCPT + 99 others); Mon, 31 Jul 2023 17:37:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51016 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230130AbjGaVg7 (ORCPT ); Mon, 31 Jul 2023 17:36:59 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 78A4B1FC7; Mon, 31 Jul 2023 14:36:38 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id F2C2D612E8; Mon, 31 Jul 2023 21:36:37 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C3F96C433C8; Mon, 31 Jul 2023 21:36:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690839397; bh=O6qxnqR2UAHIQWX1X+EfPZX7oeDEWTWYBmPMSon4/nE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=MEMWPQTNbSMkn+e0CZ1BGodCS5gupvgQ6CLcver682e8pWcF72x1wyA/dPjWgo/2k V5AGy4Tch89afNrbmK4+iF3BTc5+7qoZTzKd35MBSdq3cqbe/9929MwUR2dmqfXi4q qZt/WxnDvxbJKx5pXnfdCBDINSxWC+cdsa0cc1DueOrkGjIjeWW1phpArFKEX8WBGf U7Fa1RRvj1RODi0dYgbzik4qgX6k1DYeilEQJT+wCDYpDeAniKHTPhhA4v1HN6P2xW DNQvcQezBxRziM73g8DIm/9dxwX+vfzzYKXg5f0bC0qbkunq9N2+aAqoqhNUYWkGII GLsq7mH2CGTUg== Date: Mon, 31 Jul 2023 16:36:31 -0500 From: Josh Poimboeuf To: Valentin Schneider Cc: 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 , Peter Zijlstra , 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 =?utf-8?Q?Wei=C3=9Fschuh?= , 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: <20230731213631.pywytiwdqgtgx4ps@treble> References: <20230720163056.2564824-1-vschneid@redhat.com> <20230720163056.2564824-12-vschneid@redhat.com> <20230728153334.myvh5sxppvjzd3oz@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,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 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 I left out "pv_ops[1]" because it's already long enough :-) It would need a little bit of code shuffling. But it's really a preexisting problem so don't feel compelled to fix it with this patch set. -- Josh