Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp418338ybl; Thu, 23 Jan 2020 00:51:21 -0800 (PST) X-Google-Smtp-Source: APXvYqz8OEYtkLK/HJaK7hMCx1Kn+MGqPehYuNpfl7MPN2xc3tcghJI9i5QcUmqKVAlKEpTgPpWD X-Received: by 2002:aca:4587:: with SMTP id s129mr9593642oia.124.1579769481105; Thu, 23 Jan 2020 00:51:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579769481; cv=none; d=google.com; s=arc-20160816; b=QNWTf2kXlVzXgH5a1sGImGiZNRyNjaTV0Faa9yL99XJnIT1IXWQV7QH6rI18TcIDqT Rc7KCW2j2IvKBJACMezIhgOsRkcVpbWylc/dOi/61r8ipJ/E4PPqLdEdH8CZ2+nUYtWB 7+/fFZFsHKatdDj7p0tZq2ejCctQ25FZ4uu8f/ZUwIZHRgSHOlo6pu3djHbgWLjbFvAd 8qeK8L37uOJYKAm74EJkqIElJuXqd7tF4Zr3rnHopm9E3Gg5TQvxtl4VlnZ++Fuguto3 jE+kCQLhkUU4CuYg6a5Wb8qiTFNQ/y/Lc3V4jcHatHHBkjokqFI5QFT0kzeygi86ya2F xttQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=cK76cDDiStGL8mkcMcmDGEXVcAeHQ+2xEpgTy0QKzz8=; b=oq8T7QQTIITcZGFAwQmIEsuTYyhg6hZETYyW1/Q4qeFDoNIQypY8SSzXVJTPyqj5CJ sHikj50PUcmn5w9oELidOoiH5pddt/xvGNA0J+Lztd8nPldFcXr0wwnljeAQWq+wUJVC +A3KjtDS6lW1Ybz7q4d6bNOz9A/Njt+UqTUoJQHDrZ7Hr+m+aPgIk6zrLzvwDiZ/A4fg 4VeAlaPU5wOASDzW1AQtfrrEA0NOUFA7AEn/4TUke2ioCE7IayzvBFbzRub8LeGkSX1B vZwdT+sYOlRCDROrkBnumGnjl9KSsUiBACVytiTeXJiPwlrmT3whz5GDpl5nqh/cuDmd J2Mw== 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 k19si843025otb.118.2020.01.23.00.51.09; Thu, 23 Jan 2020 00:51:21 -0800 (PST) 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 S1727817AbgAWItS (ORCPT + 99 others); Thu, 23 Jan 2020 03:49:18 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:39449 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725785AbgAWItS (ORCPT ); Thu, 23 Jan 2020 03:49:18 -0500 Received: from p5b06da22.dip0.t-ipconnect.de ([91.6.218.34] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iuYAs-0004XP-GY; Thu, 23 Jan 2020 09:49:14 +0100 Received: by nanos.tec.linutronix.de (Postfix, from userid 1000) id C70011008DD; Thu, 23 Jan 2020 09:49:13 +0100 (CET) From: Thomas Gleixner To: Evan Green , Rajat Jain Cc: Bjorn Helgaas , linux-pci , Linux Kernel Mailing List Subject: Re: [PATCH v2] PCI/MSI: Avoid torn updates to MSI pairs In-Reply-To: References: <20200117162444.v2.1.I9c7e72144ef639cc135ea33ef332852a6b33730f@changeid> Date: Thu, 23 Jan 2020 09:49:13 +0100 Message-ID: <87y2tytv5i.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain 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 Evan Green writes: > In my experiments, the driver no longer misses the interrupt. XHCI is > particularly sensitive to this, if it misses one interrupt it seems to > completely wedge the driver. That does not make the approach more correct. > I think in my case the device pends the interrupts until MSIs are > re-enabled, because I don't see anything other than MSI for xhci in > /proc/interrupts. But I'm not sure if other devices may fall back to > line-based interrupts for a moment, and if that's a problem. Yes they can according to standard and it _IS_ a problem. > Although, I already see we call pci_msi_set_enable(0) whenever we set > up MSIs, presumably for this same reason of avoiding torn MSIs. Please stop making random assumptions. This as absolutely nothing to do with torn MSIs. The way how MSI setup works requires this. And this is happening on init _before_ any interrupt can be requested on the device. Different reason, different context. > So my fix is really just doing the same thing for an additional > case. No, it's absolutely not the same. Your device is active and not in reset/init state. > And if getting stuck in a never-to-be-handled line based interrupt > were a problem, you'd think it would also be a problem in > pci_restore_msi_state(), where the same thing is done. Again. I told you already it's not the same thing. > Maybe my fix is at the wrong level, and should be up in > pci_msi_domain_write_msg() instead? Though I see a lot of callers to > pci_write_msi_msg() that I worry have the same problem. This is not yet debugged fully and as this is happening on MSI-X I'm not really convinced yet that your 'torn write' theory holds. Thanks, tglx