Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp857967imm; Wed, 10 Oct 2018 05:32:29 -0700 (PDT) X-Google-Smtp-Source: ACcGV615/dGMYuq9zJDOrZSF/TSAqPk+smO2LFMqjcmgk8Qgl2bgEVaqN1UVvNOYCba6bxCUGdr/ X-Received: by 2002:a17:902:5e3:: with SMTP id f90-v6mr32456682plf.222.1539174749246; Wed, 10 Oct 2018 05:32:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539174749; cv=none; d=google.com; s=arc-20160816; b=SPq5c5tElmuinct1ZM50nB4jHTYtY/xWLgPbrkdUxaXL6C1IMC4CIG7pLYzK4YKrUa nCpV1XkkPHB8HkhX9TGulPnfg4wCmq9zR2VQt88E3xQXuK4KG685/Z021S9iQAKRUI7O QTxV7s0mEcgmIGWKJSPf3NW+ffLmQmZT5FNdoSgFhTTGtCl58M2sabl7gIxinL6Jh0In GGLLv3Cf0+WxT8dBVWQ2gt0xE0rDgcQUpC8n8d2Nri+IvqGB+KiVo5CLXX6wABBodkfp OyzMAg2HpAjJ68UhUN6j/Q6B1a+nGzxkKbSaZ6dZe+avYcNVq6M3oYY60ksWX58kNxk1 Ozhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=imRzilc3bKF0NXdGtl8+R4iOhtZ5xl1iuqmdMUOPdwk=; b=lM+utwNgOn9CowHXU09ph5mKHnWrY6+bnbAZNS8kB9SZncihy22vXG6Xgtxazg8E+8 FRBs3dWd0DGkCphaP5goDASSlHmGEEBidA5JwxMO19/li6WFDbsEOEm258jOi6VS0t1S oybQqtPgmZ+DDwD1EYn+I+NNIpB724Dm5xP8kHdnLRMakeH1kW7JUgqytRCtJZ7fd8bJ YOiZUkKCc/88E0jmA5EfarHw9MO2CRWzp1M4GpnSxOWsb6KbjiV1MlTIqXT5t+KWXRR9 F+yOwzDNgFgMVikQhkY2+vDE7SDdq26EYLeD1H33J59lsSy9N9TwLNiDx45IkAYuFIu3 p8fg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n135-v6si27708189pfd.38.2018.10.10.05.32.14; Wed, 10 Oct 2018 05:32:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726762AbeJJTwd (ORCPT + 99 others); Wed, 10 Oct 2018 15:52:33 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:45346 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726206AbeJJTwd (ORCPT ); Wed, 10 Oct 2018 15:52:33 -0400 Received: from p5492fe24.dip0.t-ipconnect.de ([84.146.254.36] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gADd3-0007b0-Hj; Wed, 10 Oct 2018 14:30:17 +0200 Date: Wed, 10 Oct 2018 14:30:17 +0200 (CEST) From: Thomas Gleixner To: David Woodhouse cc: Juergen Gross , linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org, x86@kernel.org, boris.ostrovsky@oracle.com, hpa@zytor.com, mingo@redhat.com, bp@alien8.de, stable@vger.kernel.org, Waiman.Long@hp.com, peterz@infradead.org Subject: Re: [PATCH 2/2] xen: make xen_qlock_wait() nestable In-Reply-To: <47686a61dfc06aa5afb05a893b9a56e6eb46763d.camel@infradead.org> Message-ID: References: <20181001071641.19282-1-jgross@suse.com> <20181001071641.19282-3-jgross@suse.com> <47686a61dfc06aa5afb05a893b9a56e6eb46763d.camel@infradead.org> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 10 Oct 2018, David Woodhouse wrote: > On Mon, 2018-10-01 at 09:16 +0200, Juergen Gross wrote: > > - /* If irq pending already clear it and return. */ > > + /* Guard against reentry. */ > > + local_irq_save(flags); > > + > > + /* If irq pending already clear it. */ > > if (xen_test_irq_pending(irq)) { > > xen_clear_irq_pending(irq); > > - return; > > + } else if (READ_ONCE(*byte) == val) { > > + /* Block until irq becomes pending (or a spurious wakeup) */ > > + xen_poll_irq(irq); > > } > > > Does this still allow other IRQs to wake it from xen_poll_irq()? > > In the case where process-context code is spinning for a lock without > disabling interrupts, we *should* allow interrupts to occur still... > does this? Yes. Look at it like idle HLT or WFI. You have to disable interrupt before checking the condition and then the hardware or in this case the hypervisor has to bring you back when an interrupt is raised. If that would not work then the check would be racy, because the interrupt could hit and be handled after the check and before going into HLT/WFI/hypercall and then the thing is out until the next interrupt comes along, which might be never. Thanks, tglx