Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp518158rwr; Wed, 3 May 2023 02:03:30 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7iHPfjfbYjvKIZoky1RaOR5YHmPjdn0sWbLhQQNGloAaKXPomKhwAmYT4Bx6vKPwggdB/V X-Received: by 2002:a17:902:d507:b0:1aa:f385:b524 with SMTP id b7-20020a170902d50700b001aaf385b524mr1633677plg.60.1683104610128; Wed, 03 May 2023 02:03:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683104610; cv=none; d=google.com; s=arc-20160816; b=IQk/aySu7jFYwz95M6HgEM6gmvJHbd7q+nvXsa7KghcLli3VqLmmD822YN+wysPjYv FQpI5sg+P+MjuRlBPFW6s4pSQxVzkxzga/SuZwOasYTbQYEUhu15ZWpf4PVkb9p7ljN+ vlWIEzyT1V/VfKpbwoVtEtG4A4TJmYmrY4UU2c+aBGy7gHQ69GOEr3Rl/+I/ooauYTQ3 Gd6/Zx2Ig0Pxdv3gGRQitVSZY7W+84nUFVrL8Caopwdp4pIA3Y0Zl0M4waFnXc3DLYJD kn1mTuEi2dXfekpUCl+BR2jED2d2v39NiH7td8yWHOrC/yjtnQvRUiGcfI284JwDkP+g fzvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=f2p0yoo0i5p3EfddnZbh5yG5oSchLdGvcnS9WBAzF48=; b=klTEqKvAIFlovcjCBtt9b4ILTeckLvOCRJYlIYUOsP9vNZ5P8DiPYEPINrUfBf11Vq yNO52j7TUfdEXVkr1UGLk/eGA2ZP2Gy3V4DoA/Rx4mV73CcHQ+1aBLM4/0wneUM77eE3 laOlnbu+Y6BMRrjvhzrb8+zKNcfXCKGNegxKG1s3KIWil/DDyXJgNdZTq21efiApt7Mr n6+K8RwQ4/Ze0d+aA7qPIJA3zFdHW4+Gn5G/PmzZZBdiH2wPOWsCY96wich15tcxXnO/ nYjKzzOi8RPTkydGx3RaRCvgTW69erra25yHnU7BwDxL5XYao+pV46xiKHI4YWy7KQ4j W6IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=EHtvlf+q; 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 u11-20020a6540cb000000b00517f7c24652si33023261pgp.890.2023.05.03.02.03.15; Wed, 03 May 2023 02:03:30 -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=20221208 header.b=EHtvlf+q; 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 S229918AbjECIyy (ORCPT + 99 others); Wed, 3 May 2023 04:54:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229804AbjECIyw (ORCPT ); Wed, 3 May 2023 04:54:52 -0400 Received: from mail-wr1-x42d.google.com (mail-wr1-x42d.google.com [IPv6:2a00:1450:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45991E4F; Wed, 3 May 2023 01:54:51 -0700 (PDT) Received: by mail-wr1-x42d.google.com with SMTP id ffacd0b85a97d-3064099f9b6so387000f8f.1; Wed, 03 May 2023 01:54:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683104089; x=1685696089; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=f2p0yoo0i5p3EfddnZbh5yG5oSchLdGvcnS9WBAzF48=; b=EHtvlf+qv5+8pmPJ2JRdBdO45v8SNHSizF3F1V6dZY2/UK5W3h+D6P/nZjqF5IJs2P hO8ojtoXO+C6iZFJqQsDmpzJn4x/l+scAfNuegluhhzAoml1eY9mhu8mw5zBAZetpXY1 KCic7dJ5tbkctiDHaB+7henMb9PTsJjmhDwIMrwgCpjS9GxioYblhDeEKxM87QZQVvvp bBVUkQeuHvNB6qzfpq/pMOzvMBGrMzih2ecEaF2ca8UAweuEy7RFZgXgab95ZY8H2K5i Bt2zdnhTuKvShyKz2yiPbPy+t1ivk8/jbInxRHv+XUhWsBMdfyZNnrH5gv2B0d2e5qSU QY8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683104089; x=1685696089; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=f2p0yoo0i5p3EfddnZbh5yG5oSchLdGvcnS9WBAzF48=; b=lDRQbZRd/rBWZ5UaLFwkJm+Pz6IACWzvOYnL5WJp/rYFcu4fBclIW9IUIVAt1PFGUa IH6vZ0I1Gohlw4eg2Z24a2BdR/o39tG8RGNtCTRigQhoiZGLCJdc/gUR9JLMRFl9GXmV PJ9XoAse9XD8X8WfCtwZXYyLo8/NWXThCJA9eBj9VZgD52PduNTDDCj/O7ewjC9wDcxU tLiSpnYEODXI1rXbRw6IUby/p4ANFPhyEKex7M7t/+37P5hcQXmtjNit9FNworA7xSVo 8b3lHV2W1p0NTjy3qxtKrbHqfn0UDf/fV+c+Rvwb2y0xfIf9nKJ7DNALZMWFs4f2Ywfy JcQA== X-Gm-Message-State: AC+VfDyEscUeRLX84Uw1Aj6oNHZREoG1yK7H60py/lSJV6oYsk3o49NM WZmSRlIbHojdr1QwM1vlcL2o/CJHQngI6wKxUWOtVOzVRg== X-Received: by 2002:adf:e5c2:0:b0:2fb:ca40:e42c with SMTP id a2-20020adfe5c2000000b002fbca40e42cmr13636086wrn.6.1683104089624; Wed, 03 May 2023 01:54:49 -0700 (PDT) MIME-Version: 1.0 References: <20230428102015.810686-1-tomas.mudrunka@gmail.com> In-Reply-To: From: =?UTF-8?B?VG9tw6HFoSBNdWRydcWIa2E=?= Date: Wed, 3 May 2023 10:54:37 +0200 Message-ID: Subject: Re: [PATCH v4] Fix freeze in lm8333 i2c keyboard driver To: Jeff LaBundy Cc: dmitry.torokhov@gmail.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" 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 > Just to clarify, my stance is that this call should go _before_ the handler > is registered. Ok, i will fix the patch later today. > Any events that come before then are off the table, and this is OK because > user space isn't going to start consuming key events until well after this > driver has probed anyway. Well, that was never my point. I don't care about capturing events that happen before driver was properly loaded. My only concern was to limit possibility of deadlock which happened previously. Because that makes device unusable till the IC is power cycled. Which might be especially annoying on devices that have power button implemented using this exact IC :-) > The reason behind my assertion is that as a matter of best practice, you > should not have two asynchronous threads that can in theory access the same > register. Yeah, this makes bit more sense now. Didn't realized IRQ might interrupt that lm8333_irq_thread() call immediately. While not very likely to cause problems like deadlock of the driver, i think it's a valid point. After all this is what happens with IRQF_ONESHOT anyway right? Each time the IRQ is triggered it's disabled, lm8333_irq_thread() is run and then it's enabled immediately after that. So i guess the behaviour on each keypress is very similar to calling lm8333_irq_thread() before registering the IRQ handler, which gives me some confidence there might not be huge chance for deadlock under normal circumstances. Though i wonder what would happen if some EMI burst would create rapid train of randomly timed keypresses, that might just hit the unfortunate sweetspot after while... Might test that later in the lab, since i really need the software to remain operational after such condition had passed.