Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1693459imm; Sat, 29 Sep 2018 02:01:32 -0700 (PDT) X-Google-Smtp-Source: ACcGV63wi7pu4WvFnjKevuKozTXuFO7F04h9+zAueFiU8/B/xy3jMVK3g0A+R2EtA2GEpuOC293t X-Received: by 2002:a17:902:8a4:: with SMTP id 33-v6mr2286674pll.65.1538211692015; Sat, 29 Sep 2018 02:01:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538211691; cv=none; d=google.com; s=arc-20160816; b=1BuC5GN1M1rdGMSafmEgw2COMwtZo7UHo4/baE1ndDGPt2YGGuAmEuImlK8mrI+/fc y2vaaQs5wteOamk4rCSKPJe0rpiHQ2c1ACq3srbmmD4C4UxlCsCOcz1ThrfbG4gI8MFk L15qGP24EvFqUzPRxJcQnRaQ03dv8b5dTdyxnQ9MmpSoPitv2yojshT2IVTfFa1AIkZR iaTnSqzWWuWHMyGoU4c1tt0LoKjHeC3nMaM14Drq56QxrlmykeirhKSPgp/ItSswHBUF Z7QUWF2aSer3lDwZzxQm4wkCu3VHRFKWealBP9N21hEBAZCyaFraHGwGlDAETH9qmt1U 59zQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=3xj7uk7bYWSxDBCior/qmqdza4Mc1TrEa5Mr5CgV9DQ=; b=KFqEL3rKgAZBYgphzvzqf1xEdWtffJ19I21sGu44V0o//VcyeiLm9Jl+tcSP0yJkqr lBauhfeyoUNGJTJi2yeKrOjyHcDaPp9HmCh9Ak6zEGbz5LVy9tp9YsFV9Cw6PKuFtYix JmzzzfY1uGnBMb78z5SYfDdtI2l7sx0hmwpJZQVW3I5JuK/JdTyxkyLmklyRQuHvUAJ3 koRSpbJw3bbpJ5Sor+znzNS68ZrTejTPsXMTjaE7PzuUW+oKZfcEt7SoLJCAe/LvyfOp ZKI1x6BLC4HlwYKC30eFdbjqNsQd+Ho1BHhc/qQc7mJqHftSqB/tbLwRIVLPOjwjG28E Y03g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RFKFXm9V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b10-v6si7350471pla.253.2018.09.29.02.01.16; Sat, 29 Sep 2018 02:01:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=RFKFXm9V; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1727813AbeI2P2g (ORCPT + 99 others); Sat, 29 Sep 2018 11:28:36 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:44362 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727540AbeI2P2g (ORCPT ); Sat, 29 Sep 2018 11:28:36 -0400 Received: by mail-pg1-f194.google.com with SMTP id g2-v6so6090133pgu.11; Sat, 29 Sep 2018 02:00:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=3xj7uk7bYWSxDBCior/qmqdza4Mc1TrEa5Mr5CgV9DQ=; b=RFKFXm9VI1+hS4OjJKwPOasFkb55OpXif7lvqk5VUVnnX5iYiU4OVcuOd3zKLKgz3x DTYG87++1TYgebsyJ0vI1npNI2ydf3yOYixBgtJcB85qlg1fA7c2pGcPfZd6Z/rCGuYg 9bm8+gTZNzlA404vxAiBPCSDhZ/Ie55GmAPT24jvXacBLKDC88p8GXFZpxpibYzpgcBD fWPZ2UNfMreYYuehLQHNqWFR794FypzLFGy/JGM39JIIThI8TjxgFv7I66L44N46cv35 PFNMIZ6rF57w1QeKvMP4jRMmsp0W4IkDxG1agPApt+5pEftWBe539tHBBR+A3M/HeC7c beZQ== 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-transfer-encoding :content-language; bh=3xj7uk7bYWSxDBCior/qmqdza4Mc1TrEa5Mr5CgV9DQ=; b=BAq0HcBWTmw1e19foHqhu36Ux6ICNmsBFoR9uWhP/uYlkwBJZnmS1jCZgQpWqq9a0K yuJx/OAgk+xtH2i4YAIKV0UsX500RPoqGn6odV7s7FrOOm0kKNPFbB36gSt1NvLtwzzR K2VZkt14eUa7naH5lL83TGB1T5Xv0vDYtmjW6YtNdnozvOpNNlwIQCRKlcax9OYFybUD Cq7Z6842xXKTQzxUmcZOIR1S5SKN7D8CuvBKFzjpWh1a1ShTpGbUmPm9lc/RqSyS5Yug q4iKhgotd+mJZBm98H6d9VdIpIA8kUyz+pwKmCULPGnCVqS8skdn5P+JFrL2dpO5PItb HS+g== X-Gm-Message-State: ABuFfojcuK/n6R7HXDktao7ktIQfSPFJE9fFjQzzxS/ZH+fdn096+gjH nJxNIgyewJZSMm0jrxy/GwF3MXya X-Received: by 2002:a65:65c6:: with SMTP id y6-v6mr2055399pgv.233.1538211656613; Sat, 29 Sep 2018 02:00:56 -0700 (PDT) Received: from ?IPv6:2402:f000:1:1501:200:5efe:166.111.71.37? ([2402:f000:1:1501:200:5efe:a66f:4725]) by smtp.gmail.com with ESMTPSA id n13-v6sm9017545pgr.73.2018.09.29.02.00.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 29 Sep 2018 02:00:55 -0700 (PDT) Subject: Re: [PATCH V2] hid: hid-core: Fix a sleep-in-atomic-context bug in __hid_request() To: Jiri Kosina Cc: benjamin.tissoires@redhat.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180913033432.16336-1-baijiaju1990@gmail.com> From: Jia-Ju Bai Message-ID: <4c0096c6-3745-963c-5086-5f579792599b@gmail.com> Date: Sat, 29 Sep 2018 17:00:50 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/9/24 17:26, Jiri Kosina wrote: > On Thu, 13 Sep 2018, Jia-Ju Bai wrote: > >> hid_alloc_report_buf() has to be called with GFP_ATOMIC in >> __hid_request(), because there are the following callchains >> leading to __hid_request() being an atomic context: >> >> picolcd_send_and_wait (acquire a spinlock) >> hid_hw_request >> __hid_request >> hid_alloc_report_buf(GFP_KERNEL) >> >> picolcd_reset (acquire a spinlock) >> hid_hw_request >> __hid_request >> hid_alloc_report_buf(GFP_KERNEL) >> >> lg4ff_play (acquire a spinlock) >> hid_hw_request >> __hid_request >> hid_alloc_report_buf(GFP_KERNEL) >> >> lg4ff_set_autocenter_ffex (acquire a spinlock) >> hid_hw_request >> __hid_request >> hid_alloc_report_buf(GFP_KERNEL) > Hm, so it's always drivers calling out into core in atomic context. So > either we take this, and put our bets on being able to allocate the buffer > without sleeping, In my opinion, I prefer this way. Best wishes, Jia-Ju Bai > or actually fix the few drivers (it's just lg4ff and > picolcd at the end of the day) not to do that, and explicitly anotate > __hid_request() with might_sleep(). > > Hmm? > > Thanks, >