From patchwork Wed Nov 14 17:55:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 151106 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5992647ljp; Wed, 14 Nov 2018 09:56:01 -0800 (PST) X-Google-Smtp-Source: AJdET5ddOGsvpu4Z7N/skdU5ndwCS8aCg/HY4ELkqWg2DhPQIFmOEQ6wS7NT6wrHAOGmJkMjuFOM X-Received: by 2002:a63:134f:: with SMTP id 15mr2639213pgt.19.1542218161214; Wed, 14 Nov 2018 09:56:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542218161; cv=none; d=google.com; s=arc-20160816; b=EwtXifnz/LN2MVSzk7Pppx2AACxRhz+QYm7XvUdKacZ2UservQ0ol0heWu+7H5jCoV 4y0plwXd53nH4qD6IfY0P/F7dhkOMXvau2DVZWmAfjRaTjEZR/f2loBS4PjpyYb51Io6 4NZ1/8uYSxcWwH11UvqdgKRFfz9BnpVSA6TMkG+7aUxDVgx+Rt3BpVd2LjYQulC1zNs3 3qeIPBqlCIUzBXHb9sOIN9dzi+7Zl1TiBFqbAYUEIu3rgJOKYnxCmQ/Nj8wVseg1FVJ5 FfYHVJRR6HOvlS3LY+TBzdBFNKTLYL8KBLezNCSx4Qa+otNGFHx8UtYnf/ou3Nug0xPF +jzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=tnZwtrfeIUnwSLpePAskWrTsX9/DkfDA/SpLBYEMRCI=; b=qBWhgWp87uDsf0TFLkuiuq7YZlxxgDGFd4f2cgAx7e/aTWRyYEvuzylWsLd0dtZRdT LSonw0hpZ/7vlxuhmaz3KhVf6p6NB2UmlDBy+nFrpvEnfv3GN8Sn+D733TQJAJDb696J 5/3TbMNRRB/vo4gMfrDKR7Yk37gsgMAeyIztzWBLcP1mJf8ppJQ2OLT37EWvT/ND1rYl pHvQvf3I+7U8w2dmwEnCfm1TajwNsLb5Xdg7sZwL9oh2N9DDu0J0bEihZ4DoN4See8yi k6qj3VT/TotjuABTn4nnc0goS4yaXOff+r4o3TbIzkUQ5FjK+0uiPfRr3xAFbkKGARmC z7gA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Etkmskss; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s14-v6si14251570plr.93.2018.11.14.09.56.01; Wed, 14 Nov 2018 09:56:01 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-efi-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=@linaro.org header.s=google header.b=Etkmskss; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727576AbeKOEAJ (ORCPT + 3 others); Wed, 14 Nov 2018 23:00:09 -0500 Received: from mail-pf1-f194.google.com ([209.85.210.194]:39651 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731710AbeKOEAJ (ORCPT ); Wed, 14 Nov 2018 23:00:09 -0500 Received: by mail-pf1-f194.google.com with SMTP id c72so3599013pfc.6 for ; Wed, 14 Nov 2018 09:55:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tnZwtrfeIUnwSLpePAskWrTsX9/DkfDA/SpLBYEMRCI=; b=EtkmskssHmg/ybwGqTO6Q8uNrMj7Ek+1vALJlR+v9S1NCcWRFFg9ZhTfmcRwOG7Rom T/YRErv3HhlCx8wb4dwXsXjzt/dfUlYPDLDpn0Pwk0qrwmgs4nsAO8D6u4v3Ls27DP3Y B+GSAs+M0qoMAyB8PTZoRK7rqPK7sPOY7ZPUY= 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:in-reply-to :references; bh=tnZwtrfeIUnwSLpePAskWrTsX9/DkfDA/SpLBYEMRCI=; b=SCp1u23YZwZzlVp/kEJmbH6OQ2qkWi0C7blR+mVDtZhjtIrXnlqj373YoWILtgXBS/ sYqWFseQLMZRZ2Gm3mU/8aOoW9a1BWGpOhdtgVupd27/cRlFIW5q+8x8v420GO3Z2w+Y vU7537jUS/yAmsrfoEJk8oKyQKQ2sOQXCCOcnLOyH88r/jNT5l+o4x+5OJgkKprSuQOj LqXqGxELe7C3Ba/vQuyPG6oIYierLiozHdm7l9rVN3Xo6fDJXZfZdO7f2x6TQ/h2K7w1 yQ6fGU7SHjIQdDtC1EdhututUanvGNEiXiHCZ3vK+Kvk+Dirjg4tL8UCPx19R91cLQOY 9W8g== X-Gm-Message-State: AGRZ1gJKx3QjQL2IIx/YXb+wPwMX8CvbK8lm9s68je9cNAYde7Y4ghlk D0eV6ifUiopkYlbzz74lk64YDQ7CUJvZIg== X-Received: by 2002:a63:2a4a:: with SMTP id q71mr2649533pgq.374.1542218157974; Wed, 14 Nov 2018 09:55:57 -0800 (PST) Received: from mba13.psav.com ([64.114.255.97]) by smtp.gmail.com with ESMTPSA id i2-v6sm21301738pgq.35.2018.11.14.09.55.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Nov 2018 09:55:57 -0800 (PST) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Waiman Long , Ard Biesheuvel , linux-kernel@vger.kernel.org Subject: [PATCH 1/5] efi: Fix debugobjects warning on efi_rts_work Date: Wed, 14 Nov 2018 09:55:40 -0800 Message-Id: <20181114175544.12860-2-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181114175544.12860-1-ard.biesheuvel@linaro.org> References: <20181114175544.12860-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org From: Waiman Long The commit 9dbbedaa6171 ("efi: Make efi_rts_work accessible to efi page fault handler") converted efi_rts_work from an auto variable to a global variable. However, when submitting the work, INIT_WORK_ONSTACK() was still used causing the following complaint from debugobjects: ODEBUG: object 00000000ed27b500 is NOT on stack 00000000c7d38760, but annotated. Change the macro to just INIT_WORK() to eliminate the warning. Fixes: 9dbbedaa6171 ("efi: Make efi_rts_work accessible to efi page fault handler") Signed-off-by: Waiman Long Acked-by: Sai Praneeth Prakhya Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/runtime-wrappers.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.17.1 diff --git a/drivers/firmware/efi/runtime-wrappers.c b/drivers/firmware/efi/runtime-wrappers.c index a19d845bdb06..8903b9ccfc2b 100644 --- a/drivers/firmware/efi/runtime-wrappers.c +++ b/drivers/firmware/efi/runtime-wrappers.c @@ -67,7 +67,7 @@ struct efi_runtime_work efi_rts_work; } \ \ init_completion(&efi_rts_work.efi_rts_comp); \ - INIT_WORK_ONSTACK(&efi_rts_work.work, efi_call_rts); \ + INIT_WORK(&efi_rts_work.work, efi_call_rts); \ efi_rts_work.arg1 = _arg1; \ efi_rts_work.arg2 = _arg2; \ efi_rts_work.arg3 = _arg3; \ From patchwork Wed Nov 14 17:55:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 151108 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5992695ljp; Wed, 14 Nov 2018 09:56:04 -0800 (PST) X-Google-Smtp-Source: AJdET5dQhtLJVc6YV3BsFx8ObuzD4/7TjF2euTvBeHnI4MlJ+gnUT6qRTXUCdMtuWVv5mrP1BLhv X-Received: by 2002:a65:6684:: with SMTP id b4mr2657508pgw.55.1542218164255; Wed, 14 Nov 2018 09:56:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542218164; cv=none; d=google.com; s=arc-20160816; b=NQNrWZYAcfwGT2OlvU7KmXzJu3da6OBXMOEk0G5YDtnCjFBvcTFp61LvyPL+xt7edt hujDPPK5vxKdSDnvF4a+5AIy5t3YoRK7kqav8/MgiV04LrGa3eHT+6INp3Sfhsn+Td5i vdhlkcnvloOyrV92+It1DPEe7RYThY33Bhh3/Nds1+7KQP1Soc9oNj/ZLHsT/7o9OYt9 6bUXUoJiIW6j8OJU3J/U6Ibal4OR86mN7krHsdon9cESCRL7dNhmJDvxeXMEGUciSlzM OOPZIfUn8EaLqUy1EETo7CXiWXLaycwniha/c5D3ldqwzQ2aWtxlJsRBaroRiZvjauGR PfHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=cOfTDhyV/l13Z99YOBzTU4ASBnqPM4veTV3UrpNLU8U=; b=Q8p3rW8hbn4+ExY2Cj3bFdpZXpxC9ygvIqc4kcbDW4KIpuNDriOU2kkcsG1rakHy1u SDDdH0rBlhdRtGCjmexHKvbOXfhHJmLdEsrtZc89MKpaMPA+f2+ZYvp8MP28cTt0j3em UAa5oL8XGvw6jWLg3isUwaJxwOjuAGBCipclTQqhZXSopADeVfLq1It5jcPb0cj9Mix4 pho3fDnogyeOiVmsIk4EMabXwDkCSQdZlWk1YS1xJyWqNndLakHmgkW43OfB/Mi6/iVD cfk3lKqxq+QkBmxy/iswIy0Cw91LMU/bC4FTuBvmpW5uo6mzjiDe8w61qkwSa6xda6UU 5BAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LUmQUVU4; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r12si24051442pgf.22.2018.11.14.09.56.04; Wed, 14 Nov 2018 09:56:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-efi-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=@linaro.org header.s=google header.b=LUmQUVU4; spf=pass (google.com: best guess record for domain of linux-efi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-efi-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731710AbeKOEAN (ORCPT + 3 others); Wed, 14 Nov 2018 23:00:13 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:34129 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732981AbeKOEAM (ORCPT ); Wed, 14 Nov 2018 23:00:12 -0500 Received: by mail-pg1-f195.google.com with SMTP id 17so7438206pgg.1 for ; Wed, 14 Nov 2018 09:56:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cOfTDhyV/l13Z99YOBzTU4ASBnqPM4veTV3UrpNLU8U=; b=LUmQUVU4WyCs9MbRR4tnyN+m/kS3DLPM5Mvp6v9xlpe0WJ2amPcqceJxIFHZdIFjIs QndZSuuA7NjrYNIjrEuVE8m5/o+knkWZmJehE0m1TjvDZ2VgbovIZJKEYb62+Xjj+9JY 9RNIsJC2lq8l0zkrqYHRb9cgrkj/kpEWhtygo= 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:in-reply-to :references; bh=cOfTDhyV/l13Z99YOBzTU4ASBnqPM4veTV3UrpNLU8U=; b=rpX2sHXXTML2KpWZSOjpe5Cfho5K6mZemCFDJBxtr5c0IEQelb7pCmzxZviL1M5SNd cOQVzVHnji9nDMuOHZcB5n6CUmkokVXpYNXNbTMcv0vYujiqbqXYi7wweNaBKLT3ZINA JBLXlXbFty6WR7YXPf4VT1m4KcfkfyMaiax+vYzU7n01s7rtbcVION2QwVN/PQINXDDR Kd1uIlufo1SFPxBIMmXNj/KTP1pkMjhnsJKWb/3Dua8UMBwaW0RPwzBd2rtGhQeI8NCP 0iMpooToiIxW6sU9hnZOls4+y45x/9DtZMKgSiJ97jJOVBjtmTWx782QhjHzPjAc0Y4B rsYg== X-Gm-Message-State: AGRZ1gK6n7nj8bxgiQpQ9NGOPt9GI1omgjGjVqaJe8vnnV1Rf2C7GuMr r3tCN4eKyBnUTCiecjN2wfjOP9LmQ2ll6w== X-Received: by 2002:a63:e80e:: with SMTP id s14mr2670371pgh.30.1542218160608; Wed, 14 Nov 2018 09:56:00 -0800 (PST) Received: from mba13.psav.com ([64.114.255.97]) by smtp.gmail.com with ESMTPSA id i2-v6sm21301738pgq.35.2018.11.14.09.55.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Nov 2018 09:55:59 -0800 (PST) From: Ard Biesheuvel To: linux-efi@vger.kernel.org, Ingo Molnar , Thomas Gleixner Cc: Ard Biesheuvel , linux-kernel@vger.kernel.org Subject: [PATCH 3/5] efi/arm: libstub: pack FDT after populating it Date: Wed, 14 Nov 2018 09:55:42 -0800 Message-Id: <20181114175544.12860-4-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181114175544.12860-1-ard.biesheuvel@linaro.org> References: <20181114175544.12860-1-ard.biesheuvel@linaro.org> Sender: linux-efi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-efi@vger.kernel.org Commit 24d7c494ce46 ("efi/arm-stub: Round up FDT allocation to mapping size") increased the allocation size for the FDT image created by the stub to a fixed value of 2 MB, to simplify the former code that made several attempts with increasing values for the size. This is reasonable given that the allocation is of type EFI_LOADER_DATA, which is released to the kernel unless it is explicitly memblock_reserve()d by the early boot code. However, this allocation size leaked into the 'size' field of the FDT header metadata, and so the entire allocation remains occupied by the device tree binary, even if most of it is not used to store device tree information. So call fdt_pack() to shrink the FDT data structure to its minimum size after populating all the fields, so that the remaining memory is no longer wasted. Cc: # v4.12+ Fixes: 24d7c494ce46 ("efi/arm-stub: Round up FDT allocation to mapping size") Signed-off-by: Ard Biesheuvel --- drivers/firmware/efi/libstub/fdt.c | 4 ++++ 1 file changed, 4 insertions(+) -- 2.17.1 diff --git a/drivers/firmware/efi/libstub/fdt.c b/drivers/firmware/efi/libstub/fdt.c index 8830fa601e45..0c0d2312f4a8 100644 --- a/drivers/firmware/efi/libstub/fdt.c +++ b/drivers/firmware/efi/libstub/fdt.c @@ -158,6 +158,10 @@ static efi_status_t update_fdt(efi_system_table_t *sys_table, void *orig_fdt, return efi_status; } } + + /* shrink the FDT back to its minimum size */ + fdt_pack(fdt); + return EFI_SUCCESS; fdt_set_fail: