Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp232590pxa; Tue, 11 Aug 2020 01:13:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyouVlp19Fzl/SgH/GSmvEnO04bKAeBp8mRhwaFPd9HT4NTsx4zKWy/s9CzJcrz/fBdZYso X-Received: by 2002:aa7:d899:: with SMTP id u25mr23943994edq.255.1597133634047; Tue, 11 Aug 2020 01:13:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597133634; cv=none; d=google.com; s=arc-20160816; b=U3uSczb73P3We5Hdjzd34BgNhi8kAsnr9IbKGyWFKZJ+BCAsmet+5v6VylCg7HRaU6 41LenscXapSs8X4Su7xd+2BuXYUCW/6nc0ptsRPE6N7Ik8UWoocOwcDgJAOZWLIZFx8I Evati1o/NZREv6smVQYZItZ3GARjv5zaR8ReQdCIyM0olXBHSKcSN4LvthE767Df9nYu eD0nc8KO6D1qsePf9fn/bhIz+mrcFRPNhYbxgXrj+D1WP6Fih9Eu+deFssChYibX1AjY C8aRCHkiPo6EXeRzzES/iPmd6V5NEgBpvuJhGpFMeUpM3SO+MXpT848TWgj6+pUOICnD aWdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Dh9BiEVz6epUQSvBxpIbJVz7h5uxpAes5kiPqWr2N0U=; b=H5qqcSnWHh10DqAgB4glShg42y7s8dqs6Po2Njj56IMRGi1WvnuDv3obz+LI6ODcmu GwcEvEDvXXkRsl1cktAa3SL8eBqpj2trXC1KKiaF4Uoc/4CGw5Ru0gEhwd1TnoqAbAmM rFRGrgft8XIvkX4Je7V7sV4P4DfEBV+Ai2/s79aFX8GxYEKea64ZlIZS8LBc4WFh5qTn OVjZFh0UchtH/LcYOtEnxFcW02Bq3CzK9kTNohGbdAlEpPlZPYCP3yE0oOKuMzAJ9OfS DVjS8n3Rkzme6+r1s1GlWnx6etg3Ljn+LIJnHjsCVB9YPYkqxmtsevQZX8HJhYz+ZHJl QnGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=casper.20170209 header.b=X5W5zo0+; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e12si4698991ejr.708.2020.08.11.01.13.29; Tue, 11 Aug 2020 01:13:54 -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=fail header.i=@infradead.org header.s=casper.20170209 header.b=X5W5zo0+; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728326AbgHKIM1 (ORCPT + 99 others); Tue, 11 Aug 2020 04:12:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728000AbgHKIMZ (ORCPT ); Tue, 11 Aug 2020 04:12:25 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 801C3C06174A for ; Tue, 11 Aug 2020 01:12:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Transfer-Encoding: Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date: Sender:Reply-To:Content-ID:Content-Description; bh=Dh9BiEVz6epUQSvBxpIbJVz7h5uxpAes5kiPqWr2N0U=; b=X5W5zo0+0m8POb2sgcLnXP4bPg mk0vObilIOFyEj+A5HaEz+W1jDJt1wcG62Ovyz2EWSieVA+fS3grO2WfYNFeND3dKw6EA3l8YsF9t qtohHGWUKY5eaHpmYO7ANKECXrOSwRjyckhuDD4FrDcdAI5M5WICMmSlc20ps9Pg3BTFcaS1Ap98g WnN/ysi9XMStwYB8MxYQYf7J/65n0WMSp2+R1EkCxxztnL9XqMef/tUN8xKszVgPGRvxeeA4Pyi3l xuO3Td1khhxEdMkLFaeXx0ZRmriZCAYURHYuyRwZBCjAc0NFw0vAiWpEl+fYUHPhntl5sMGpQSrfT EJ7FWlYA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1k5POA-00074x-1J; Tue, 11 Aug 2020 08:12:06 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id A3665980C9D; Tue, 11 Aug 2020 10:12:05 +0200 (CEST) Date: Tue, 11 Aug 2020 10:12:05 +0200 From: Peter Zijlstra To: =?iso-8859-1?Q?J=FCrgen_Gro=DF?= Cc: Marco Elver , 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, sdeep@vmware.com, virtualization@lists.linux-foundation.org, kasan-dev , syzbot , "Paul E. McKenney" , Wei Liu Subject: Re: [PATCH] x86/paravirt: Add missing noinstr to arch_local*() helpers Message-ID: <20200811081205.GV3982@worktop.programming.kicks-ass.net> References: <20200807095032.GA3528289@elver.google.com> <16671cf3-3885-eb06-79ff-4cbfaeeaea79@suse.com> <20200807113838.GA3547125@elver.google.com> <20200807151903.GA1263469@elver.google.com> <20200811074127.GR3982@worktop.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Aug 11, 2020 at 09:57:55AM +0200, J?rgen Gro? wrote: > On 11.08.20 09:41, Peter Zijlstra wrote: > > On Fri, Aug 07, 2020 at 05:19:03PM +0200, Marco Elver wrote: > > > > > My hypothesis here is simply that kvm_wait() may be called in a place > > > where we get the same case I mentioned to Peter, > > > > > > raw_local_irq_save(); /* or other IRQs off without tracing */ > > > ... > > > kvm_wait() /* IRQ state tracing gets confused */ > > > ... > > > raw_local_irq_restore(); > > > > > > and therefore, using raw variants in kvm_wait() works. It's also safe > > > because it doesn't call any other libraries that would result in corrupt > > > > Yes, this is definitely an issue. > > > > Tracing, we also musn't call into tracing when using raw_local_irq_*(). > > Because then we re-intoduce this same issue all over again. > > > > Both halt() and safe_halt() are more paravirt calls, but given we're in > > a KVM paravirt call already, I suppose we can directly use native_*() > > here. > > > > Something like so then... I suppose, but then the Xen variants need TLC > > too. > > Just to be sure I understand you correct: > > You mean that xen_qlock_kick() and xen_qlock_wait() and all functions > called by those should gain the "notrace" attribute, right? > > I am not sure why the kick variants need it, though. IMO those are > called only after the lock has been released, so they should be fine > without notrace. The issue happens when someone uses arch_spinlock_t under raw_local_irq_*(). > And again: we shouldn't forget the Hyper-V variants. Bah, my grep failed :/ Also *groan*, that's calling apic->send_IPI().