Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2188721imm; Sat, 29 Sep 2018 12:21:09 -0700 (PDT) X-Google-Smtp-Source: ACcGV60NKpH4zeAAuTnCgIRQ7gczH+Lcq4+Opv9eu9hlsUguzM41TNPnnMAzjg4WpzAhPi/m5r4D X-Received: by 2002:a63:2ad4:: with SMTP id q203-v6mr2171382pgq.356.1538248869479; Sat, 29 Sep 2018 12:21:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538248869; cv=none; d=google.com; s=arc-20160816; b=hPray5xZl37tghyH/IV9bVylSkxcolXWBmF8NAfkQmwgg8czCSoDHaFYyDbMBd+Udh Lqpdr1DpkMiUnOGgRaxM9RMJ6yHovlmHmvZ+vhp3B7Iz7ryBNZQKG8djzbxJg1qmgI6M f+fEVUKco/gELrsyEJN0e8tplaXW7Gm4F/0TGRVqwM6upHKL8ym2WmGD0GWJy5EBLIlV UjXyJ8DfNXxVIVYRXZlzj3OCOzCWFcGAkOaARRk6fufJl5ZPlGkZY7zS3sf8goZtqTHu UHkC+sDUvKREf8fHd3bRiAXovpL/+SY8Iz9oX7ft2/4pLkLvFnqqVnvs/RnRWpdRwYNX gIeg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=/RuoBJD8rKU4BxdRKuhbPYwG5CTYiRZ3ckpFe7KKCzk=; b=grl6lenKfY4M/UtLnZjUcpYabHNvJA0Df5Qf3lRzwkONPGQixDoDMBVTI9GQ2iiOMY AI+pWdcrf1vj3g3AAQqBiAw03ksepRMR1yTq4WNnf88qu86qRkehzFUWwxQWVT+OODTK RyyNdkbDPPtfvvI/a5XzYNfLeQ43q7/DNQMFauozw9KtS/J5FHjbzMiJb3AoXO5LDpfR 74T8OFpE9+DNRvbJgPOHCYeaVtU+TH46tMO9WKH1G0kjDJ7PcTuzGUCGeOpw2exWvCDx t7HXr6F49+Wu+XWW/54cuoJ95mZtNhVpIWk6jJVU4SIliQTVPe1KPa3Kmaj6uPaIKW1B tj4g== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id k4-v6si8120911pgm.591.2018.09.29.12.20.54; Sat, 29 Sep 2018 12:21:09 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728006AbeI3Btp (ORCPT + 99 others); Sat, 29 Sep 2018 21:49:45 -0400 Received: from mx2.suse.de ([195.135.220.15]:55674 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727621AbeI3Btp (ORCPT ); Sat, 29 Sep 2018 21:49:45 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id DD6C1AF02; Sat, 29 Sep 2018 19:20:07 +0000 (UTC) Date: Sat, 29 Sep 2018 21:20:07 +0200 (CEST) From: Jiri Kosina To: Jia-Ju Bai cc: benjamin.tissoires@redhat.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2] hid: hid-core: Fix a sleep-in-atomic-context bug in __hid_request() In-Reply-To: <4c0096c6-3745-963c-5086-5f579792599b@gmail.com> Message-ID: References: <20180913033432.16336-1-baijiaju1990@gmail.com> <4c0096c6-3745-963c-5086-5f579792599b@gmail.com> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 29 Sep 2018, Jia-Ju Bai wrote: > >> 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. Why? Forcing all the report buffer to be limited to be non-sleeping allocations just because of two drivers, looks like an overkill, and actually calls for more issues (as GFP_ATOMIC is of course in principle less likely to succeed). -- Jiri Kosina SUSE Labs