Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp745702lqt; Tue, 19 Mar 2024 02:31:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXjMGSaMWXivy0TCBw2xPESLgq4/ZFGx4DQypb+1KS1+d6UlM0v5mvaVGx6orIIlZu6PEjn6ixILwWsa9MMcsJz0/uyoWdkIHmcrwprNA== X-Google-Smtp-Source: AGHT+IH5obXDLy+fnisSYjNZQSdbU/kqq8dXSI4BXQYYqtUo5WHJ/Qgcug9G/n6VUCc09zAFKI6H X-Received: by 2002:a05:6808:384b:b0:3c3:899a:6adb with SMTP id ej11-20020a056808384b00b003c3899a6adbmr6161387oib.51.1710840691310; Tue, 19 Mar 2024 02:31:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710840691; cv=pass; d=google.com; s=arc-20160816; b=y4ujYTV7u+NZC5QdSW4tDocG1/jlJnMl0P3Igyn+Dd/qLywdS6cIylKueM4GpjkJYI IghtTe6is/lD8deIc0U5ERqYPJSgk6bwy1DxqJrvBWEfAJlgxpUIY8+y+wxdTESxSW82 Vdb0qjlTBosmz22p4TUTFuiC9JIhXJMwCmI1dkVcfPDtAb2obmRprBhzFKvZwgSYOat2 LgTfnwYcOi73PNq9YlY+BZCeyeLp02bmy2HOb/muAG3p3zbRajmePhYKeTsLqEjACYg1 43FyGIpolSAu1NzEBWYcJZf64VzgTqSfj0pHBU5x1ATsZXCu+TdqR36uKWORgYoiUcEs FkYQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VQki1eI8SVL7vuknmmrJsXB51tDn6Ie+ozgQSfZSEjw=; fh=qRXECnOTLBpYuqQbGuC11UOFFx9QcWlv9ipjLq7AJfY=; b=A6OBlFuRBWhyOOehxb/dv3c7kmKizlh8RbCaeTN9Gbqsr8oYEsEJwmlE9p/JJ63JUi 68rS/Ccxqmx1kp1/01z3CLN3FWN5MiwYp+b4qEre+7IpTJxnGY3LaEQRUajS4r+pW4t8 jsrez8e2SMpJgNpxOhUMGED7Iqk1lNp+DIY5G0nIloY3mcNsycR6lbkLotMYGl2aYBni IqiksTRc7vdqIMAb5K27U7oeed83VAwS4nkTnpY3Y2BCwE4S8tfmsuTYGmbtnFuP32Ml 9Mktpxl6BWlxVKeysoHfYavUHNGwQQTe2Mt6CrDmsuYvY9gLMux7S3aZHB5Z3rncsYY8 DICA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=lYIHsT0V; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-107299-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107299-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id a5-20020aa78e85000000b006e635eab42fsi10600130pfr.137.2024.03.19.02.31.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Mar 2024 02:31:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-107299-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=lYIHsT0V; arc=pass (i=1 spf=pass spfdomain=mediatek.com dkim=pass dkdomain=mediatek.com dmarc=pass fromdomain=mediatek.com); spf=pass (google.com: domain of linux-kernel+bounces-107299-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-107299-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 71CDFB21609 for ; Tue, 19 Mar 2024 09:31:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 804067CF26; Tue, 19 Mar 2024 09:31:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="lYIHsT0V" Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2241D51C28 for ; Tue, 19 Mar 2024 09:31:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.61.82.184 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710840679; cv=none; b=pJsaXLJ6xO9f+2wMYEMzkNAUPtK8HJuK4mr/+0vqO4H2z0GJ77Tqrkn5nLe5mN+HDHFCQrjxBEjI6nVQp0OMs7iGb+Qpao/XZ8HcV6XrTFVznBW4qvBxlDCDyhSOGQe3BRPDVlB69eZ4+5vFiewUtJsdP2yqEycD9s4rRFxyaeY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710840679; c=relaxed/simple; bh=SY1uQyt8vSR2v8hUPxa5exu6uGYaOX8KaWkKj+cinQ0=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PSlwo9H73C9HS1h6TQ2Os0ssJW1G6ifI7Famb1p1VrB1mbckwZgz4dQd+6fuzHLhFt48EotRSDszk1gSEbPunddp89Ew/Nw6tuR3N1j7tB15S+aSTEs7aahYlHYmwiq4XRiivSCFcNsTRCgqLxwKxE3TwyGvnpAi/n/rf+Vbzvc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com; spf=pass smtp.mailfrom=mediatek.com; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b=lYIHsT0V; arc=none smtp.client-ip=210.61.82.184 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=mediatek.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=mediatek.com X-UUID: 6d0cc3a0e5d311ee935d6952f98a51a9-20240319 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=VQki1eI8SVL7vuknmmrJsXB51tDn6Ie+ozgQSfZSEjw=; b=lYIHsT0V9fBsEoJX7/h7vSysOBHnUiQ3MGSiKFaIyaULp3g2ClQzTPNq4ld9dl39Or2Zw8Ki5Tlh5n2F3eMCO5cd+HRH8NdVJZIg/DEHce/yCsjQYmV3XjJvn86h8w9SxKuRLYKJVfHKVXzT4KE4zWyplE0UAOc7/Vcaq95NzeY=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.37,REQID:83c72e98-dede-4092-a416-a30ed9b27c0c,IP:0,U RL:0,TC:0,Content:-5,EDM:0,RT:1,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION :release,TS:-4 X-CID-META: VersionHash:6f543d0,CLOUDID:26d02c85-8d4f-477b-89d2-1e3bdbef96d1,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:0,File:nil,RT:nil,Bulk:nil,QS:nil,BEC:nil,COL:0,OSI:0,OSA:0,AV:0,LES:1, SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0 X-CID-BVR: 50,UGT X-CID-BAS: 50,UGT,0,_ X-CID-FACTOR: TF_CID_SPAM_SNR X-UUID: 6d0cc3a0e5d311ee935d6952f98a51a9-20240319 Received: from mtkmbs13n2.mediatek.inc [(172.21.101.108)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256) with ESMTP id 1627979646; Tue, 19 Mar 2024 17:31:12 +0800 Received: from mtkmbs13n2.mediatek.inc (172.21.101.108) by mtkmbs10n2.mediatek.inc (172.21.101.183) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Tue, 19 Mar 2024 17:31:10 +0800 Received: from mbjsdccf07.gcn.mediatek.inc (10.15.20.246) by mtkmbs13n2.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.2.1118.26 via Frontend Transport; Tue, 19 Mar 2024 17:31:09 +0800 From: Guoyong Wang To: "Jason A . Donenfeld" , Theodore Ts'o , Tejun Heo , Lai Jiangshan , "Matthias Brugger" , AngeloGioacchino Del Regno CC: , , , , "Guoyong Wang" Subject: Re: [PATCH] random: Fix the issue of '_might_sleep' function running in an atomic contex Date: Tue, 19 Mar 2024 17:30:55 +0800 Message-ID: <20240319093055.3252-1-guoyong.wang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain X-TM-AS-Product-Ver: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-AS-Result: No-10--2.984400-8.000000 X-TMASE-MatchedRID: scwq2vQP8OFq0U6EhO9EE97SWiiWSV/1jLOy13Cgb4+qvcIF1TcLYHG3 IDkkj7AXYYnmnL3l3X94CDdDyzWksYoNUbXqhOogEdFsavUQKAeVq+okl1rYD4m3+evajL3wMTM ELdGCO1o7+AqDyYkkE7zhRZbj1fFhMRXV8lvz/l2GuzokAQvW7hLXa2P1m93zpbyIsT/ya8HwgB OtAk1RzXjz1W+ftiuwTkPoEKaGtfHN81HPMxpUIJ4CIKY/Hg3AGdQnQSTrKGPZs3HUcS/scCq2r l3dzGQ1rmN9FZqI8KahkbtarVEBrUNxfO5fJyW5aZTIZgj8uzW+tXmB1d47djB5zPBa/PuxMGNP 4LoAdn2LY5R/XxIRza5kCR6qopRbE1GeEHxFMW90BNB20+SxH7f8mJY57oZddJaBDYald1mHO0t VYDV4T0MMprcbiest X-TM-AS-User-Approved-Sender: No X-TM-AS-User-Blocked-Sender: No X-TMASE-Result: 10--2.984400-8.000000 X-TMASE-Version: SMEX-14.0.0.3152-9.1.1006-23728.005 X-TM-SNTS-SMTP: D8CB58CF87B07B83D4FF05979176682EBF85968089EDCB2E320408EFDFA00B6C2000:8 X-MTK: N On Mon, 18 Mar 2024 21:00:42 +0100, Jason A. Donenfeld wrote: > I'm wondering, though, rather than introducing a second function, maybe > execute_in_process_context() should just gain a `&& !in_atomic()`. > That'd make things a bit simpler. > However, I'm pretty sure in_atomic() isn't actually a reliable way of > determining that, depending on config. So maybe this should just call > the worker always (if system_wq isn't null). > Alternatively, any chance the call to add_input_randomness() could be > moved outside the spinlock, or does this not look possible? Hi Jason, Thanks for your suggestions. I am inclined to accept your second suggestion. My reluctance to accept the first is due to the concern that "&& !in_atomic()" could potentially alter the original meaning of the 'execute_in_process_context' interface. Regarding the third suggestion, modifying the logic associated with 'input' is not recommended.