Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp805215pxa; Wed, 5 Aug 2020 13:13:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZPg7DdgT0BqH4yFQ1+7IoiRWvQTV2p/1miZOiMkA8Hll8On+d7M8zCzQxFTCsN/16U/su X-Received: by 2002:a50:9d8a:: with SMTP id w10mr995423ede.16.1596658384137; Wed, 05 Aug 2020 13:13:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596658384; cv=none; d=google.com; s=arc-20160816; b=FaYyXMkN/QQGTxzcmEqtzVzEOr9HN/n+6Mmx3S5EjL0dAGp1VH2nb7M5E3eS1jbvA/ MVl8+nn7AmATD07cxnMvQye5REuzEpJUDH0yqJG/SBAMeQ9FwjvpIsUumo+RB9L9Sipq Jdwymd4PN4U6rv+qmhENyLgZ0XUTnDmEF3K9VMjeRGUIxJIf0Xac/kE/06dZzYl4DDRM 6bQV59nJm2f8AIwYW41Wbcnh89RgeZrvdfOfUwXOLc9Goad1Z2P7cSTjY8hIGLpZJ89e aGcA1++fGLgVZ9B9uh+YwoSbFxCCA0eRwKiT9O/AxL70Y5bl3alCJWorKlPt5exhGRuQ SjIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=nPbiD7579GQktE8TnDJJA8yObifQYqFq9LVQt+NlZPM=; b=QcsJn1jbZOIFfoRZFjsmDFbMgxRApdckjXpQvXpROcwki+RyWOixDwe14U78/A/Qg3 1b12zvpMwdytg1AES4hX7hTY4SOs6+to9ArThs/LEF3I/34WSpdkVXhNOGCeini8NOZQ kO/TK+43jNLV5xfFPO6++DTc9hR9CC5iE5M5bNiMk+un0DV3didJpeOPrO7oYrrS8JhD v4S6MNXHwW5/4HTpTn3oHH+NbYXJnTKVFOnIZ5PzE0+nChnDgM4Mjua8pDb7+/V392cZ Hagdkj3lEJmCtwgbPq70vq2v9WiIK00BiM0Wj94wFUy1ndHlYjDZ67VBwhSERTfXxUZK s0eg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=j1JMhs8V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k19si1882437ejc.710.2020.08.05.13.12.41; Wed, 05 Aug 2020 13:13:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=j1JMhs8V; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729800AbgHEUMh (ORCPT + 99 others); Wed, 5 Aug 2020 16:12:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726955AbgHEQZe (ORCPT ); Wed, 5 Aug 2020 12:25:34 -0400 Received: from mail-oo1-xc41.google.com (mail-oo1-xc41.google.com [IPv6:2607:f8b0:4864:20::c41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 855FFC008699 for ; Wed, 5 Aug 2020 07:36:27 -0700 (PDT) Received: by mail-oo1-xc41.google.com with SMTP id y30so1079306ooj.3 for ; Wed, 05 Aug 2020 07:36:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=nPbiD7579GQktE8TnDJJA8yObifQYqFq9LVQt+NlZPM=; b=j1JMhs8VF3wjt1nwB/Qsiv0ydH2tqGRaF1GcVJl46CVK+YD01QsJrivwalAX8mS8mv /RRjM2DTAEvgzCtjf8pgBhHBVDI1cc2YgBtq6kom614haN8nsoAd3RTdL0V4p4aiRzrk 5a5EQ4wgp0vo2n4Th0XOCcRN7yYGPRLFrncAvHzkDrEHoglLdZAL/YfDPQdVgoZCkeXT toq/zJ4Hq7pObJEa43WDdAC90IfisfI/wvAWFTXh8S8Ol1u0oUkWNBmlijEwyiV7ETDa EwSHx8+t86PBrYjFJQpxiWZsD7/rodDUxa2UysziH0yYvl2O8lS22aFV0QFsaeA/7Eq9 C8zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=nPbiD7579GQktE8TnDJJA8yObifQYqFq9LVQt+NlZPM=; b=RaUVYW7MA7tDVYjvL9IMgrQYDRpfR61ntvWe/l27EnSO3KpUJ00xNEQaP7UVR0UkJB cdBwbqBEd5d86JsfMLAQIomc9LNxGYWPANUMCLIgve5DKDlWw0s1uSprX2dy8HvDsi3F HjXDQms0PpVTlK9x1s0+or4wKrME4lTxgxh08grs5PoPr2ke5OKEvGN0TObEHuirjsnW Zb2d/DY1bXgK5NAf9+n4R94d/vf13AOYA8HEBAwnOkxedT6MrxemH7WftHnp0hwD76N8 Bku1bYtb3eRWWGSTtvZb3zwZvwPB/WkBJDGv46+UQXK7zuoIBx2UAFM7ea3KQkwuCYpg ssuA== X-Gm-Message-State: AOAM5303gJa65K9SQKMKAqx9+sAH5dnQf4r6TJRGC7WF5gS6Kx78VmRk hEN1NMs5FW7MTIBhd37i6UcKvGC74cBIxNrj+dVW1g== X-Received: by 2002:a4a:a648:: with SMTP id j8mr3132445oom.36.1596638185370; Wed, 05 Aug 2020 07:36:25 -0700 (PDT) MIME-Version: 1.0 References: <0000000000007d3b2d05ac1c303e@google.com> <20200805132629.GA87338@elver.google.com> <20200805134232.GR2674@hirez.programming.kicks-ass.net> <20200805135940.GA156343@elver.google.com> <20200805141237.GS2674@hirez.programming.kicks-ass.net> <20200805141709.GD35926@hirez.programming.kicks-ass.net> In-Reply-To: <20200805141709.GD35926@hirez.programming.kicks-ass.net> From: Marco Elver Date: Wed, 5 Aug 2020 16:36:12 +0200 Message-ID: Subject: Re: [PATCH] x86/paravirt: Add missing noinstr to arch_local*() helpers To: Peter Zijlstra Cc: Borislav Petkov , Dave Hansen , fenghua.yu@intel.com, "H. Peter Anvin" , LKML , Ingo Molnar , syzkaller-bugs , Thomas Gleixner , "Luck, Tony" , "the arch/x86 maintainers" , yu-cheng.yu@intel.com, jgross@suse.com, sdeep@vmware.com, virtualization@lists.linux-foundation.org, kasan-dev , syzbot Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 5 Aug 2020 at 16:17, wrote: > > On Wed, Aug 05, 2020 at 04:12:37PM +0200, peterz@infradead.org wrote: > > On Wed, Aug 05, 2020 at 03:59:40PM +0200, Marco Elver wrote: > > > On Wed, Aug 05, 2020 at 03:42PM +0200, peterz@infradead.org wrote: > > > > > > Shouldn't we __always_inline those? They're going to be really small. > > > > > > I can send a v2, and you can choose. For reference, though: > > > > > > ffffffff86271ee0 : > > > ffffffff86271ee0: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) > > > ffffffff86271ee5: 48 83 3d 43 87 e4 01 cmpq $0x0,0x1e48743(%rip) # ffffffff880ba630 > > > ffffffff86271eec: 00 > > > ffffffff86271eed: 74 0d je ffffffff86271efc > > > ffffffff86271eef: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) > > > ffffffff86271ef4: ff 14 25 30 a6 0b 88 callq *0xffffffff880ba630 > > > ffffffff86271efb: c3 retq > > > ffffffff86271efc: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) > > > ffffffff86271f01: 0f 0b ud2 > > > > > ffffffff86271a90 : > > > ffffffff86271a90: 53 push %rbx > > > ffffffff86271a91: 48 89 fb mov %rdi,%rbx > > > ffffffff86271a94: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) > > > ffffffff86271a99: 48 83 3d 97 8b e4 01 cmpq $0x0,0x1e48b97(%rip) # ffffffff880ba638 > > > ffffffff86271aa0: 00 > > > ffffffff86271aa1: 74 11 je ffffffff86271ab4 > > > ffffffff86271aa3: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) > > > ffffffff86271aa8: 48 89 df mov %rbx,%rdi > > > ffffffff86271aab: ff 14 25 38 a6 0b 88 callq *0xffffffff880ba638 > > > ffffffff86271ab2: 5b pop %rbx > > > ffffffff86271ab3: c3 retq > > > ffffffff86271ab4: 0f 1f 44 00 00 nopl 0x0(%rax,%rax,1) > > > ffffffff86271ab9: 0f 0b ud2 > > > > > > Blergh, that's abysmall. In part I suspect because you have > > CONFIG_PARAVIRT_DEBUG, let me try and untangle that PV macro maze. > > Yeah, look here: > > 0000 0000000000462149 : > 0000 462149: ff 14 25 00 00 00 00 callq *0x0 > 0003 46214c: R_X86_64_32S pv_ops+0x120 > 0007 462150: c3 retq > > > That's exactly what I was expecting. Ah, for some reason the __always_inline version does *not* work with KCSAN -- I'm getting various warnings, including the same lockdep warning. I think there is some weirdness when this stuff gets inlined into instrumented functions. At least with KCSAN, when any accesses here are instrumented, and then KCSAN disable/enables interrupts, things break. So, these functions should never be instrumented, noinstr or not. Marking them 'inline noinstr' seems like the safest option. Without CONFIG_PARAVIRT_DEBUG, any compiler should hopefully inline them? Thanks, -- Marco