From patchwork Thu Jan 21 10:41:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sumit Garg X-Patchwork-Id: 367808 Delivered-To: patches@linaro.org Received: by 2002:a02:a60d:0:0:0:0:0 with SMTP id c13csp442089jam; Thu, 21 Jan 2021 02:41:36 -0800 (PST) X-Received: by 2002:a17:902:728b:b029:de:c843:1d4c with SMTP id d11-20020a170902728bb02900dec8431d4cmr11733598pll.84.1611225695999; Thu, 21 Jan 2021 02:41:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611225695; cv=none; d=google.com; s=arc-20160816; b=ePdVriU2d1874ZXDkVtOq/SwjW8zaCDsMzD6efqROyjwR0f1OVWkzAtg1wjSPpn2Lp Nh4YclBkVDYaxzBcC1XcEHcu0i1VecMeReKtrpBUxSLUS8Wo8sfFY+WvEEkrtkpGaull vfqJmzsatnToX8+bpagPWgP+lKPwzJTcZqNBWcz46HcUimrfyGz2x3OF+ay0Qe3z5ppH fkO7sYC3vjSqp9ZGEjmHOsEQ2aG9wlNbdEgLJgp1ZW0D12dBn3SMW5AF79WUv8j80z9d t7zJk69GiudaU1HJ258cNt4OVzbRN2wHlRWSOd4qhKxYnGlMWJOaRLY0FmYlc/I+Izq1 ytAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature; bh=QDRHLmIYC5050Kr14mdBq51gUJgf5cxu0sy6mjEEkNs=; b=Bd2Vn7WXYfMwkPG+rXO4X1AEmiVc8SzroSQSciyEc09jr0nrHqShrIEJutX0PCk519 w3SvS+hoQ0+p52XaQqzqrji3rYJ8EfxG1aRTP62MfwuorxGCjf2SMQWfj1NpKSOj1/uw vzIxytrAgJ7aWjW64FN65kYLml3xRnU6lud837Dy+yNhDCCVKtfmFbwvTurlYjiF79K5 F+imU5smLs0/nEdhrvbVrcz3D3Wv5H7Krm8rE/QqQQdFxuzmESofx+TNLtGXVOTLaRbO PuKI8S18vrZfB+GoYJT93woLQSdiQZwYgu4XqxPgyn+bzdeil9z6PX+V5TFFu+lq/LAB CIxw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WfuCjzyc; spf=pass (google.com: domain of sumit.garg@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=sumit.garg@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id u3sor2644821pgq.84.2021.01.21.02.41.35 for (Google Transport Security); Thu, 21 Jan 2021 02:41:35 -0800 (PST) Received-SPF: pass (google.com: domain of sumit.garg@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WfuCjzyc; spf=pass (google.com: domain of sumit.garg@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=sumit.garg@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=QDRHLmIYC5050Kr14mdBq51gUJgf5cxu0sy6mjEEkNs=; b=WfuCjzycNvGTxvIYxoGwQONp+cNWCIKZcpfyA1JSYScYNeCFk30CpNvsex2CFTX7m6 rNTQG7fiOf8WLC5rm40mPDcQz0VKg+dxGPfGFNdc9zFkF80dSEt2fxBKWjf4CWg0cDD9 8Tb3o1sMRyion+hk3atfcjhKPl3Ri4Bufa2a6Gvy7RC74qcEHwJ9lBQZYP9oIKXrK0cB a2mYzsoyiDNVdjf5KUJSQPwZWmNMov/H2kAIAt/kt0oE9Y9w491v3goN18N04r9+Wtml H/p7DBLFqi9zHOEvi/F6GLuHlzDOQ94TTV4coV8xOWJlYC0LxrWnnVHqjaeLDdtjfPed +bmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=QDRHLmIYC5050Kr14mdBq51gUJgf5cxu0sy6mjEEkNs=; b=PGaY8XiZTUgi9sKUJ5xDeegUJK12VHoUIus2XjO5qVVJ0OK0JAYHIxuWteObV1Gg4r yIVlD9NqPA6W12meLckIf6HOqmwvgTyfHh5y+TscuGrKzzlQCrVEFfg60tZGmYkPmeIU k6X6KJXI+PgvVXmU7FyKGVzNGnPe3cESNUtT/u7YT/wE37Ebs/muZLcMyQetdqRqHNAZ N01Pg2FsYGGLuWJtsV9p80KjgQxePExAVS9vRxQqiivipRZHaF7dGab62h3NsaDS4vVm jt1pVJSuLcyyYR/ZqxZnZJd5dh/8CfxUOuJkIRH5kALHi0dS0yUcPvjc7Ol2FYC+2wrs d3FQ== X-Gm-Message-State: AOAM532Y1+mxwRm4bKEnrQYYqwwB0vPN9K+6ocNWN8xmhPfdjCRopOT1 XCqTGtFGjiT3ce12rU5lwcIqQW7G X-Google-Smtp-Source: ABdhPJwCv/lEi9CrGn/9F1orPfl4mly2X7DBuqFWlxv9f+l/tmWswEPjgxT+Mu4de6Yig25GPfjb9w== X-Received: by 2002:a65:5ac1:: with SMTP id d1mr7284693pgt.447.1611225695609; Thu, 21 Jan 2021 02:41:35 -0800 (PST) Return-Path: Received: from localhost.localdomain ([122.173.53.31]) by smtp.gmail.com with ESMTPSA id a31sm5107955pgb.93.2021.01.21.02.41.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Jan 2021 02:41:34 -0800 (PST) From: Sumit Garg To: daniel.thompson@linaro.org Cc: patches@linaro.org, Sumit Garg Subject: [RFC INTERNAL] kdb: Make memory allocations more robust Date: Thu, 21 Jan 2021 16:11:11 +0530 Message-Id: <1611225671-2917-1-git-send-email-sumit.garg@linaro.org> X-Mailer: git-send-email 2.7.4 Use in_atomic() instead of in_interrupt() as the former is more appropriate to know atomic context and moreover the later is deprecated. Also, use atomic allocations when kdb entry is in normal task context [1] with interrupts disabled. [1] $ echo g > /proc/sysrq-trigger Signed-off-by: Sumit Garg --- kernel/debug/kdb/kdb_private.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.7.4 diff --git a/kernel/debug/kdb/kdb_private.h b/kernel/debug/kdb/kdb_private.h index 7a4a181..40bf351 100644 --- a/kernel/debug/kdb/kdb_private.h +++ b/kernel/debug/kdb/kdb_private.h @@ -231,7 +231,7 @@ extern struct task_struct *kdb_curr_task(int); #define kdb_task_has_cpu(p) (task_curr(p)) -#define GFP_KDB (in_interrupt() ? GFP_ATOMIC : GFP_KERNEL) +#define GFP_KDB (in_atomic() || irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL) extern void *debug_kmalloc(size_t size, gfp_t flags); extern void debug_kfree(void *);