Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2245075ioo; Mon, 23 May 2022 13:44:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTpX72mLBTONJA0m6BM/eAgwMiP0L6OiRBArSQNHnewgafonC89aJRjflrxKX82zRNLDlK X-Received: by 2002:a05:6402:354f:b0:42b:6da9:ed5a with SMTP id f15-20020a056402354f00b0042b6da9ed5amr6169441edd.148.1653338661623; Mon, 23 May 2022 13:44:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653338661; cv=none; d=google.com; s=arc-20160816; b=1All2GuJDOcZE8m3olEP8O6vU9Na+MOIx8Zlv8tRUrxR0fvL01a1OTvhvo2VtaUeGF e53ewulwO34pCxjVO+vhrCR+rRQMhO9zD3NNoXiQNXDiyULHsOTlieCHBW8Pv8NM9VTR ADTEikd3S6K5JDyCM312iWdbCQK/W99yK5N9qPDumFP9C3tknGEX/jUOjGb9kfimWoZr +NlVKcX3yLhaDjDoSxfjw3KByaJHei0C5LZJZGm9Qvrxg4WX49NrefG8zztvOKvlPOe6 tl3Cc0CtCNb6svaUoE4L1ycU3usHKrb9AOvHV9YtIuWb8mDSqnKz25km/iCFmwZdj54m 2U8Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=LW25NSTQI4crBK2YwHHSQC3zzTXMP62tjU83/8uLCds=; b=DGjXL2qzYgMVbRlH4WNzmi1DugOJFC4usjtI4rQ9h1EQieC4xXzh+cfdTFgxjEmYww bj35CQ8HRKnpPEze879ujfa/EUqJaRzXuxw0ClX3ky69I//LiUfjj0UYlUZy84bPyDPo mVLag7EsCmwVad4ml8Tz+T4c9GXOVj0OOqSSMeGoBBLuZOmiWkPnJVU288tn/IN+qRTB pLYGgG4Em7mI1HOXv+tj48IjEP5zOrtop7re7r1KFJxKnMru3daTWQ5dSRInfLi4il2c tj3j/g0jv1EZIyxn+UpbAcEeCyclpWVjcE1N7beJ4Xujy9ckYcUrTUalPw9HNoiHJ1XJ by3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UEFeXxCN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cq1-20020a056402220100b00426199f0b07si15998959edb.611.2022.05.23.13.43.55; Mon, 23 May 2022 13:44:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UEFeXxCN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229812AbiEWTnb (ORCPT + 99 others); Mon, 23 May 2022 15:43:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233161AbiEWTlq (ORCPT ); Mon, 23 May 2022 15:41:46 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50D2B1084 for ; Mon, 23 May 2022 12:35:54 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id gi33so22450920ejc.3 for ; Mon, 23 May 2022 12:35:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=LW25NSTQI4crBK2YwHHSQC3zzTXMP62tjU83/8uLCds=; b=UEFeXxCNbRpI46/QElKf5Oc+lGtL2Zq8b580qymrLS2hT1gN2x2k4YLnGaHhIflRda FTlC2aJa+Wf5tTV15adNd+RSH+3YiKMkzFSSFPLIjn0WHXuB8jmS+5Z0A7qT0dDpCM09 9dtVDguxK+rz77qtO/pQkWy7NzRnvT6pLcNKCOYlSZxkU/FYbFHQXJiWxGWSUpCED+L0 7DBFrie6eD34D34RZ8x+KAOfnOSfWHdtmvzRB46q7Giek85VU9jS8CrqNbWDNnO1qkGq hNWHt+E9Cdy+aL9nAdW54T7kWSFU3JZKfHOZ8r7OOx56cqxzfKT/EQznLJ041nE+cu7G Pl7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=LW25NSTQI4crBK2YwHHSQC3zzTXMP62tjU83/8uLCds=; b=x8KclGb+lamkVy8vujIssSylBpjkhRfLK0OTCHuCrSZHihXLGPNhPIyeDaBMB5/LWZ n1i3rs7K2fIH4U65AxWP/sQq3FeK2GV0r1li5lP4MreoSx0rEN0HuDpvU2pdbD/bQL+y R0rg+KxFOJFAwiPEAGjsO0SA2tDCxgbGFYz+/2krMw4CAJ4rJ9bTrWbHbsXikEOHGoTE cKg5TVpj+/pQtWc30ZENOiARwP4b1eOxuCbdhkM6uCpqMbrNnWGm2I4uISyq83gNlOis oOt7vCUQ9pQ/F+4CAGauOFKdBk/yozIKIPIkM/qN8a/XVnEPlc9/YAHfrWH69+lpY+Bo 2UrA== X-Gm-Message-State: AOAM5303cGq1WPdUxmzow3XAlHdGFOzgiQdfTwHdJvPcNVLP7KoHLv9E ycPb58xVQsNb68T2jQl5U0H3kV9NZYODLdEfArhCrzw7 X-Received: by 2002:a17:906:7f89:b0:6fe:8e6b:f16c with SMTP id f9-20020a1709067f8900b006fe8e6bf16cmr20874969ejr.390.1653334552777; Mon, 23 May 2022 12:35:52 -0700 (PDT) MIME-Version: 1.0 References: <20220331070115.29421-1-bjorn.ardo@axis.com> <487bbd00-d763-0a86-9984-1dfd957fbb38@axis.com> In-Reply-To: From: Jassi Brar Date: Mon, 23 May 2022 14:35:41 -0500 Message-ID: Subject: Re: [PATCH] mailbox: forward the hrtimer if not queued and under a lock To: Bjorn Ardo Cc: kernel , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 23, 2022 at 6:56 AM Bjorn Ardo wrote: > > Hi again, > > > On 4/20/22 10:28, Bjorn Ardo wrote: > > > > > > Our current solution are using 4 different mailbox channels > > asynchronously. The code is part of a larger system, but I can put > > down some time and try and extract the relevant parts if you still > > think this is a client issue? But with my current understanding of the > > code, the race between msg_submit() and txdone_hrtimer() is quite > > clear, and with my proposed patch that removes this race we have be > > able to run for very long time without any problems (that is several > > days). Without the fix we get the race after 5-10 min. > > > > > > > > I do not know if you have had any time to review my comments yet, but we > have created some examples to trigger the error. > Thanks, but your last explanation was enough. The logic seems fine. I was hoping someone impacted by the commit may chime in with a tested/acke= d by. I think I'll pick it up now. Thanks. > > With the attached testmodule mailbox-loadtest.c I can trigger the error > by attaching it to the two sides of an mailbox with the following > devicetree code: > > mboxtest1 { > compatible =3D "mailbox-loadtest"; > mbox-names =3D "ping", "pong"; > mboxes =3D <&mbox_loop_pri 0 &mbox_loop_pri 1>; > }; > > mboxtest2 { > compatible =3D "mailbox-loadtest"; > mbox-names =3D "pong", "ping"; > mboxes =3D <&mbox_loop_scd 0 &mbox_loop_scd 1>; > }; > > > After that I create load on the mailbox by running (or respectively > system) the following: > > while echo 1 > /sys/kernel/debug/mboxtest1/ping ; do > usleep 1 > done > > while echo 1 > /sys/kernel/debug/mboxtest2/ping ; do > usleep 50000 > done > > After a few minutes (normally 2-5) I get errors. > > > Using the patch I sent earlier the errors goes away. > > > We also have created a mailbox-loopback.c that is a loopback mailbox > that can be used on the same system (to make testing easier on systems > that does not have a hardware mailbox), it is also attached. This can be > probed by the following devicetree code: > > mbox_loop_pri: mailbox_loop_pri { > compatible =3D "mailbox-loopback"; > #mbox-cells =3D <1>; > side =3D <0>; > }; > mbox_loop_scd: mailbox_loop_scd { > compatible =3D "mailbox-loopback"; > #mbox-cells =3D <1>; > side =3D <1>; > }; > > And with this loopback mailbox we have also been able to reproduce the > errors without the patch applied. > > > Best Regards, > > Bj=C3=B6rn >