Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp5155ybg; Mon, 27 Jul 2020 13:53:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJytdQueN4hZJaqMWhe/4IdVZ236PqFNXLAsiALo0Q9JXvdxC7pJ9zSnSHJACX/hcnRGFxWG X-Received: by 2002:a17:906:3a4c:: with SMTP id a12mr6122955ejf.306.1595883180447; Mon, 27 Jul 2020 13:53:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595883180; cv=none; d=google.com; s=arc-20160816; b=OobWoDWf6rRqB0DnQw3usM748eqngwiLd9DzyoqkIq8VPd0ZbpXO1vRumRKoeDdl+y +TrVyHxkwJF0+DDs7QMJWpS0mKB4cQTIrAOGLYMAgdD4wN6GL1io+CwOR4ZxnPDbF2Ln fj2EhLpaco2I/rG/uv1G/laMTWiIAWJxEWYP/yd7zdH8HfYsHcfejFdXn9zggF1FmpXu Z/8FWXGr/L3xIXeJjzhs6OgRsxjyFqpkg0LCudfLFqgmVKWPsYfHB06uzY80z/YgSx9y IFUWh6tuEq79HAltBX3yBSyC6Ca/T98veZE/TTqPcUPNWB9Nc7WXmMEn2YlLC/lPlR8i nDFg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=LwHk6aa0qzWcTC/yZuHgrolyluxfSo5KPunX5fqAGbw=; b=okop9UoCXp3hE4atCjHMI4IUCWYbRj7ggUD0V2nAS2/eL8XRgSG3FtraX9xC+YFUdu A7AsoqkYAOKNv04959njGsbbeZcnJICkauihnht8vw58k/RQ7gZuSi1RElVk/7/V3J4J uGMZtAAnkKNrgwAMuX6EN1NsqQFHG2mITONSJWi7TPrkpjXe58qWo5uCp/X3Fd9DpQxl PAuaeO8GPkPJQAyhKpd9tI+Z+x6P53yX4OT3tFuzzWowW7fxynj7YXAR8GLTVrQwGjR+ e5L8vydCLy01Q9lnBCh4URfNnKCDrgiJ+eDbylmHTWKarruVcAg6JmHq1Fqiqzq7Alku 39UA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=UTb5moqR; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d9si5241499edo.522.2020.07.27.13.52.38; Mon, 27 Jul 2020 13:53:00 -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=@broadcom.com header.s=google header.b=UTb5moqR; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726953AbgG0Uns (ORCPT + 99 others); Mon, 27 Jul 2020 16:43:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726916AbgG0Unr (ORCPT ); Mon, 27 Jul 2020 16:43:47 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3FC1C0619D2 for ; Mon, 27 Jul 2020 13:43:46 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id f18so5486842wmc.0 for ; Mon, 27 Jul 2020 13:43:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=LwHk6aa0qzWcTC/yZuHgrolyluxfSo5KPunX5fqAGbw=; b=UTb5moqRzvVRGSeOsC/tlyLbR357acEUdpQNQ2CoohhFjd9JActentaHcrF/mWR85k bKxt9YfCyoJI8HKYpGp9j0GJc0giVxFKEZUIozT68pVPTSpkPmVb0pL6MK7jFZgVsF7X P4cqwFmeLdEqvq9BZHICVTzuhCcBOITHdEHCA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=LwHk6aa0qzWcTC/yZuHgrolyluxfSo5KPunX5fqAGbw=; b=Ck5oW/mPqG5m9V6ebUCj9BxAdL/4oFqnt2tpsj9R8sQEBQqktIflk5PgM4krG81C11 VByJVruHx5l+h+niIbbCQhGf2iDrUpMavbkqEp2rzz+S9KubqIub9AyS4spoS3E3VQVl jhlHIVDJyfkMUpoCaST2B2Cb5ZcFn884mANRY+fOhmRrO9aMXg+G5IJG1EejojJvvJJP 0UchMt8Czfr6F+RtIBN4zFuUqVgCRwoodcl/cuLd37Gmabb39U/TfRd/+tkirvcFoirv TotH996DM2yCGGIYfhCYWmWgW54iCB8+N9b/kF7ZrtRbfPwKABrf/ljqGJpuyK+sPas+ LfCA== X-Gm-Message-State: AOAM530t4FIeJDHcDRHTr8OLt6+JFXqXd1MWSS5ucag1TR3XfrmB0fpH 6WtQQeNrAD62a+5rdLjsCnZfXA== X-Received: by 2002:a7b:c76e:: with SMTP id x14mr863850wmk.176.1595882625429; Mon, 27 Jul 2020 13:43:45 -0700 (PDT) Received: from [10.136.8.246] ([192.19.228.250]) by smtp.gmail.com with ESMTPSA id v11sm12099019wrr.10.2020.07.27.13.43.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 27 Jul 2020 13:43:44 -0700 (PDT) Subject: Re: [PATCH] i2c: iproc: fix race between client unreg and isr To: Wolfram Sang Cc: Dhananjay Phadke , Rayagonda Kokatanur , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, Ray Jui , bcm-kernel-feedback-list@broadcom.com References: <1595115599-100054-1-git-send-email-dphadke@linux.microsoft.com> <116ac90c-8b49-ca89-90a4-9a28f43a7c50@broadcom.com> <20200722104128.GK1030@ninjato> <5048cf44-e2c2-ee31-a9fb-b823f16c2c7d@broadcom.com> <20200725101815.GA1519@ninjato> <4cf12c92-889d-ffbf-f8de-c1e08cfb8ce9@broadcom.com> <20200727181346.GA1034@ninjato> <20200727202657.GA18997@ninjato> From: Ray Jui Message-ID: Date: Mon, 27 Jul 2020 13:43:40 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20200727202657.GA18997@ninjato> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 7/27/2020 1:26 PM, Wolfram Sang wrote: > On Mon, Jul 27, 2020 at 08:13:46PM +0200, Wolfram Sang wrote: >> >>> Can you confirm that even if we have irq pending at the i2c IP core >>> level, as long as we execute Step 2. below (to disable/mask all slave >>> interrupts), after 'enable_irq' is called, we still will not receive any >>> further i2c slave interrupt? >> >> This is HW dependant. From my tests with Renesas HW, this is not the >> case. But the actual error case was impossible to trigger for me, so >> far. I might try again later. But even in the worst case, I would only >> get a "spurious interrupt" and not an NULL-ptr OOPS. > > Let me explain how I verified this: > > 0) add a debug print whenever the slave irq part is called > > 1) Put a 2 second delay after disable_irq() and before clearing > interrupt enable register > > 2) unbind the slave driver in the background, triggering the 2s delay > > 3) during the delay, try to read from the to-be-unbound slave in the > foreground > > 4) ensure there is no prinout from the slave irq > > Worked fine for me with the Renesas R-Car I2C IP interface. As mentioned > before, I couldn't trigger a bad case with my setup. So, I hope this new > fix will work for Rayagonda's test case, too! > Sure. I suggest Dhananjay gives the sequence you proposed here a try (with delay added during the testing to widen the window to cover corner cases). If it works, we can just go with your proposed sequence here. Thanks! Ray