Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2379927pxa; Fri, 7 Aug 2020 09:41:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxnPzwXVJXiO37XPiCaBfGfB6DCwHoZFyCGlrqtVplUfwlestnamXZcw7Y4aeMXzDpTaisd X-Received: by 2002:a17:906:d8b6:: with SMTP id qc22mr10690184ejb.468.1596818486241; Fri, 07 Aug 2020 09:41:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596818486; cv=none; d=google.com; s=arc-20160816; b=BK80By0lV7gsUO7HFLjObZAH+1HLr1XGC++7/tV2MJJwZhVkfyDZCwhpBDFxX68Z4b 7mAxiKcBsxxUVnTSIz8qhTl7MySMKFSKkeaf8pHM75GU7INd3CVVIZ9JYQjqbIClOugF rHyhwWlhTTWtkSStRcD8U6CeQoYVgjIyy9hbpdKcrzlSuRNHi8euBByaEwSjchTNDsnW GpRwHiqewGyW4zzsPyvkfT5VUqzYdymJzz3K1oJceJHyWkg/jHb8nnuT7wr609tb4QFx 39gxRnhgAcoKJEICTIRu+5LwFD2As5lX1rFN18F+Cq70NJG5+STOkBP8RqL3jnpUbmmN XEeg== 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:to:subject:dkim-signature; bh=7MlPgb6G7MRWKetSxLBPIn4G5T6xBNw3EZ7AtQ9Ybwc=; b=r68W5LZvL3WYi1XDIaWLNQ7OMNkCkQmnKT2HNyCtmHKuZC/9qGBHqA9PT5c3QYrDWt x2fReSGL991Sp6qpyLtYOKIW6qDzPu80xK0fdgoL5ep+VF+JgvjscIFNztcvXU63rliM TUmQL7rhxyOGXRHcJ+Pc+r2UN2PBKyWif1IeZrHwnSgQX0OjvUeOBvAKoQZ2g1ia64aU pcdbGpG9vG9kSx310ZWmQvQwwM+oI75qRpkdoU2PF96pLrbGS764NM49FhcmLc4qj861 Y2Xi6gPDWpOObbuLiMdrfTnI/188G1OxthFMnsZiuP0iq+46ROHH8zkXHbxgVi5LzNlk Z0tQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=arPbKFhx; 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 b23si5496953ejv.299.2020.08.07.09.41.02; Fri, 07 Aug 2020 09:41:26 -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=arPbKFhx; 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 S1726186AbgHGQk3 (ORCPT + 99 others); Fri, 7 Aug 2020 12:40:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725934AbgHGQk2 (ORCPT ); Fri, 7 Aug 2020 12:40:28 -0400 Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EBE98C061756 for ; Fri, 7 Aug 2020 09:40:27 -0700 (PDT) Received: by mail-wr1-x441.google.com with SMTP id l2so2250403wrc.7 for ; Fri, 07 Aug 2020 09:40:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=7MlPgb6G7MRWKetSxLBPIn4G5T6xBNw3EZ7AtQ9Ybwc=; b=arPbKFhxxyyboW1VBkC62G21qD3kowo3A8JmoTGQPfZ22/u6amzmKXjsRjlqgTwqiL uez3c5KPFX90oOIQK5z9X9s7bkUlWB0bTHO6MLOLeuMn1YRNQqN/h7rO8C4Q89zd+eIH 6dWJ9kGtlZv7f7IUm+tw5eGtXP7vjE/WfgkrE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=7MlPgb6G7MRWKetSxLBPIn4G5T6xBNw3EZ7AtQ9Ybwc=; b=SMxZ0wYPN7Un2Jpc37wba71/fLifPAHdBoRImmS11k5vjFNX+mzdJLXltfXGoPCcdt biCLhEWJikVrxzLpdrymXpEOc40b0mqwbKWh7Enmrhn9DqgeeL3P/ZasIKDOOOiej5Hl j0LPie4ztKhPe1Q7bqcyBW/6hX6H1iu7qv4DNkF5I/oDfBqsk4OgPDQYlM7Tl1nUW7yE +2Bga/oaj3lyMLt7LNDWodkmW9d4iQR/y+5dIN0bVhE+WC8NzRkqcPzdC6nxy/6igkEs vKtBobzomZAYq+mZUk86FNzXZKXK1ZE57ou2IebyTrBSW1vnt7EPkd4T5xFCWB6FOgpr Hndg== X-Gm-Message-State: AOAM530jsFrhVLcQxq24LA6xyeSga5COjv+5GJ6W60lZu7PKBmJYL4RT cg8JDx2KLbeyAzHx5J0L4v8qog== X-Received: by 2002:adf:b602:: with SMTP id f2mr12258316wre.186.1596818426294; Fri, 07 Aug 2020 09:40:26 -0700 (PDT) Received: from [10.230.0.249] ([192.19.228.250]) by smtp.gmail.com with ESMTPSA id d21sm11018559wmd.41.2020.08.07.09.40.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 07 Aug 2020 09:40:25 -0700 (PDT) Subject: Re: [PATCH] i2c: iproc: fix race between client unreg and isr To: Wolfram Sang , 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> <20200805091725.GI1229@kunai> From: Ray Jui Message-ID: <574e1d63-cfe0-8e0b-1b45-f91ee9b3cb84@broadcom.com> Date: Fri, 7 Aug 2020 09:40:21 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.11.0 MIME-Version: 1.0 In-Reply-To: <20200805091725.GI1229@kunai> 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 Hi Rayagonda/Dhananjay, On 8/5/2020 2:17 AM, Wolfram Sang wrote: > On Mon, Jul 27, 2020 at 01:43:40PM -0700, Ray Jui wrote: >> >> >> 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. > > Any progress yet? > I don't know if Dhananjay is actively working on this or not. Rayagonda, given that you have the I2C slave setup already, do you think you can help to to test and above sequence from Wolfram (by using the widened delay window as instructed)? Thanks, Ray