Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1362703lqa; Mon, 29 Apr 2024 06:40:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWZu5grEFRbz59lk2sQ3QcbEnBS1208ywl/jofZub3GICLnPdAccNt0kpRXEvfZXR1OWVHQ8fnS4XbazDI/Z8KfUvRf8O6RJ+FegvkhfQ== X-Google-Smtp-Source: AGHT+IGGzzGKtpIS/9wZ1aiGp/nt4JNGwp+hyL22bIPnJTTA9w+6M/h8am3ekciYYH2/zdxcrwKD X-Received: by 2002:a17:902:f805:b0:1e2:b137:4f88 with SMTP id ix5-20020a170902f80500b001e2b1374f88mr10910079plb.30.1714398001711; Mon, 29 Apr 2024 06:40:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714398001; cv=pass; d=google.com; s=arc-20160816; b=jGaKxhJgYAVmU/bVy3NbakjIN7riLfuquXo/q3uE20OgKN3llzk2BnnrsQFlCKsUqA pYGhxqwQG3LAdO152v2wswJSs8hZ9yAFjm7753bTatHBy7h+9BBQTFNEXInnWjTtlpqQ i6L+U+5XUVR6TD+QOYtXua5eZwz8DoqIAnr9mOgaJ8rC1OZ9taaAAMeHQQkaDXAjjF40 zsryXh2mw+SMIfOWqJQ31S9eTXu6KR/NX6hcEcAzxLt9FzPTr5ALzvuqiQ+P/M8EmmfA BaRlHW28Z4pVssJCZjLN4EQzVSJbZZ1j8B2FlmV3DWYugqIHv2X2vAxghCADWyDtF8FU AbTw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id :sender:dkim-signature; bh=Od7rioCub18qrOw7/BFOsjSATLNjYiS/mKg/ogsd1xY=; fh=sSXKLKzAitTIg3PRFw/4Xm9Ec8mdcE4Zf/PYBI4aAW8=; b=Kq/N7wvHRDm6m4DW0C6hIlsJ0YoWSpcvVd/cspQT/m702x4XVxRlWFZN7+329Fhsh7 LiZWfbW8tMKDcZxV93RBtcUQCVTOmkE+6CrFB9SIz6l7nC22cZ/9GGvE+MQvmqivGL+u 2MCA3v9a62/ceAkaUh6xRB1m7UcYR8O6XbnfVspBHbx+8dIXegc15YpcDodJyF4fr9As S2FFRk0qvCb4Odf+IR6EHZ1E0Z0gfczg1XdLeLx57reXEJXJNiXETIhMC3sHvUGsiopM tjjpvMl+W7KdujBnI8WDbjb0ODx+cQx2In0ReR9hSIt7jxepu9/M1blM1t/T14tuDZca BbPw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kap14cc+; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-162373-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162373-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id e14-20020a170903240e00b001e797d47ee3si17738686plo.76.2024.04.29.06.40.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 06:40:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-162373-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kap14cc+; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-162373-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-162373-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 5D43328502D for ; Mon, 29 Apr 2024 13:34:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8AFA571745; Mon, 29 Apr 2024 13:34:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="kap14cc+" Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E80356BB28; Mon, 29 Apr 2024 13:34:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714397645; cv=none; b=CNv7C2FP95bkJ/ydJpN80UNKyxlk12MJWwRus6ere5hCFPk22jDbDFJqKVKfJEMs0oddqwkVo3KLv0WZRvPBtuJGrGM8qnG8bkW87ilBI3Tt+wJscvtnOBPezXWUzGzPahkLB8wadNP8Q1E9vHuSqj45R9aFcYTEpCDEMlGWWe4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714397645; c=relaxed/simple; bh=Rc6B3MamMkjyoHlP+wt/ai17Jy1UIxlbiEwOvmSPqV0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=kVqmWvPJbVCTUYxjlZwa4UACcpxt7QCx7ofcO3Y4qOJGMMiJsx3Zl9MPaQnQKMoOnRN92bm0f9FWNzLgZL6KvOFO0XseeyoFkk/BFZuasIVtBAWTAL9ETPQsa9+IUC9QEeLtQz2SLYh8H9uLNnkd7QSPp10Bw31xujnovAPEev4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=kap14cc+; arc=none smtp.client-ip=209.85.210.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=roeck-us.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-6f3e3d789cdso2492365b3a.1; Mon, 29 Apr 2024 06:34:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714397643; x=1715002443; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:sender:from:to:cc:subject:date:message-id:reply-to; bh=Od7rioCub18qrOw7/BFOsjSATLNjYiS/mKg/ogsd1xY=; b=kap14cc+1aWWPdh9aEsdZE2m6/Am98cN0hXx+cmRdW2tH7uzAUE9GLrNss8exk8tue YnMFqhFGhxenoet0FZYpfilF5bpfsBvx7WhH5+3PHoERvmIOkQ1Jg77LzitQqE3tIJQe OY95r40oTqPJMJXyHaMgjR87sBdvvQI5mADtCXHk+nDqY27P61egELgfz87cBDDGs3Pn u1ELMLXB0q41Rmk6XphOVpfduCaTUKDtEvbsM35V3E+G4OkqcbXjc22+vbevqvTz7lQs +Yc6uukDBYOmjl6TyzNYohgxY6gL6BHz4RZZJR3/GBsIJ7YZ+W7aZEBJxCP0hPljVOHO EKbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714397643; x=1715002443; h=content-transfer-encoding:in-reply-to:autocrypt:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Od7rioCub18qrOw7/BFOsjSATLNjYiS/mKg/ogsd1xY=; b=bFmWVLyQYbQUUA1cio6sljpU5zF64/vSx81stcGM9ZBuA4M6w55RV0dlZHerGeSqs5 cg9D9rmg1xgs5rGd90rodSTzFo9J49mHVCmZ0Ct2m/l3buDtKbxQtYTJHbcjJwwzzGpx 8SD8z2eT2OqVOeKCVibD66iQWxSug+ADIamZoPvwCHsKYVibJPryH6Ws2mKT2RBS/svJ 7qJy3kM+2FNN28nO1ONxVz2G3H10JEKC3V5Rg4Nvwi8jNAb6eBvNS1icgu71op6rzULq v3lWSeLkPMdT3rhZwbtpCyQCaDEC4Wo+0lUDmXQRuDI4T/FHZNx3yffnjU+GeiAcraIP ENNw== X-Forwarded-Encrypted: i=1; AJvYcCVYIxertRqcDXGM7ioXH5O8yp/bKS6aSBXUI5oP+yz3VtckNX/X69yLSgCZY7hwje7csS7OUJmOkPd2YYDT533Tiq1GezNn2CND+CdIorwFBzFWLYQhYIOcew6+v7f7/dqkbYN4+Yu/ X-Gm-Message-State: AOJu0YzpCDMUCmcUeXu4bJw96Vkwk/SHioLY70TYLtSIw/JhLImXp4W5 WZVXphH+mEVDLc5iCI7uukQt76NlXttr5C9jPAiE7/XK4/1NRgXf X-Received: by 2002:a05:6a20:4389:b0:1aa:8fe2:5adf with SMTP id i9-20020a056a20438900b001aa8fe25adfmr15474753pzl.15.1714397643227; Mon, 29 Apr 2024 06:34:03 -0700 (PDT) Received: from ?IPV6:2600:1700:e321:62f0:329c:23ff:fee3:9d7c? ([2600:1700:e321:62f0:329c:23ff:fee3:9d7c]) by smtp.gmail.com with ESMTPSA id d6-20020a63d646000000b005dc8702f0a9sm19132054pgj.1.2024.04.29.06.34.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 Apr 2024 06:34:02 -0700 (PDT) Sender: Guenter Roeck Message-ID: Date: Mon, 29 Apr 2024 06:34:00 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2] usb: ohci: Prevent missed ohci interrupts To: Gerd Hoffmann Cc: David Laight , Alan Stern , Greg Kroah-Hartman , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" References: <20240424195951.3749388-1-linux@roeck-us.net> Content-Language: en-US From: Guenter Roeck Autocrypt: addr=linux@roeck-us.net; keydata= xsFNBE6H1WcBEACu6jIcw5kZ5dGeJ7E7B2uweQR/4FGxH10/H1O1+ApmcQ9i87XdZQiB9cpN RYHA7RCEK2dh6dDccykQk3bC90xXMPg+O3R+C/SkwcnUak1UZaeK/SwQbq/t0tkMzYDRxfJ7 nyFiKxUehbNF3r9qlJgPqONwX5vJy4/GvDHdddSCxV41P/ejsZ8PykxyJs98UWhF54tGRWFl 7i1xvaDB9lN5WTLRKSO7wICuLiSz5WZHXMkyF4d+/O5ll7yz/o/JxK5vO/sduYDIlFTvBZDh gzaEtNf5tQjsjG4io8E0Yq0ViobLkS2RTNZT8ICq/Jmvl0SpbHRvYwa2DhNsK0YjHFQBB0FX IdhdUEzNefcNcYvqigJpdICoP2e4yJSyflHFO4dr0OrdnGLe1Zi/8Xo/2+M1dSSEt196rXaC kwu2KgIgmkRBb3cp2vIBBIIowU8W3qC1+w+RdMUrZxKGWJ3juwcgveJlzMpMZNyM1jobSXZ0 VHGMNJ3MwXlrEFPXaYJgibcg6brM6wGfX/LBvc/haWw4yO24lT5eitm4UBdIy9pKkKmHHh7s jfZJkB5fWKVdoCv/omy6UyH6ykLOPFugl+hVL2Prf8xrXuZe1CMS7ID9Lc8FaL1ROIN/W8Vk BIsJMaWOhks//7d92Uf3EArDlDShwR2+D+AMon8NULuLBHiEUQARAQABzTJHdWVudGVyIFJv ZWNrIChMaW51eCBhY2NvdW50KSA8bGludXhAcm9lY2stdXMubmV0PsLBgQQTAQIAKwIbAwYL CQgHAwIGFQgCCQoLBBYCAwECHgEC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8FnU mDW4+i+XlNFUPUYMrIKi9joBhu18ssf5i5Q= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 4/28/24 23:49, Gerd Hoffmann wrote: > Hi, > >>>> + /* repeat until all enabled interrupts are handled */ >>>> + if (ohci->rh_state != OHCI_RH_HALTED) { >>>> + ints = ohci_readl(ohci, ®s->intrstatus); >>>> + if (ints & ohci_readl(ohci, ®s->intrenable)) >>> >>> Doesn't the driver know which interrupts are enabled? >>> So it should be able to avoid doing two (likely) slow io reads? >>> (PCIe reads are pretty much guaranteed to be high latency.) >> >> No, the driver does not cache intrenable. > > Does the driver ever change intrenable after initialization? > $ git grep -e intrenable -e intrdisable drivers/usb/host/*ohci*c | grep ohci_writel drivers/usb/host/ohci-hcd.c: ohci_writel(ohci, (u32) ~0, &ohci->regs->intrdisable); drivers/usb/host/ohci-hcd.c: ohci_writel (ohci, OHCI_INTR_OC, &ohci->regs->intrenable); drivers/usb/host/ohci-hcd.c: ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); drivers/usb/host/ohci-hcd.c: ohci_writel (ohci, mask, &ohci->regs->intrenable); drivers/usb/host/ohci-hcd.c: ohci_writel (ohci, OHCI_INTR_UE, ®s->intrdisable); drivers/usb/host/ohci-hcd.c: ohci_writel(ohci, OHCI_INTR_RHSC, ®s->intrdisable); drivers/usb/host/ohci-hcd.c: ohci_writel (ohci, OHCI_INTR_SF, ®s->intrdisable); drivers/usb/host/ohci-hcd.c: ohci_writel (ohci, OHCI_INTR_MIE, ®s->intrenable); drivers/usb/host/ohci-hcd.c: ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); drivers/usb/host/ohci-hcd.c: ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); drivers/usb/host/ohci-hcd.c: ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrenable); drivers/usb/host/ohci-hub.c: ohci_writel(ohci, OHCI_INTR_SF, &ohci->regs->intrdisable); drivers/usb/host/ohci-hub.c: ohci_writel (ohci, OHCI_INTR_INIT, &ohci->regs->intrenable); drivers/usb/host/ohci-hub.c: ohci_writel (ohci, OHCI_INTR_SF, &ohci->regs->intrenable); drivers/usb/host/ohci-hub.c: ohci_writel(ohci, rhsc_enable, &ohci->regs->intrenable); drivers/usb/host/ohci-hub.c: ohci_writel(ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable); drivers/usb/host/ohci-q.c: ohci_writel (ohci, OHCI_INTR_SF, &ohci->regs->intrenable); > PCIe reads are expensive, especially in virtual machines where this > goes vmexit to qemu, so doing that for a piece of information the > driver should have (or is able to calculate) should indeed better > be avoided. > I would agree, but I really think that should be a separate patch if implemented. Guenter