Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp1160454ybb; Wed, 1 Apr 2020 17:14:04 -0700 (PDT) X-Google-Smtp-Source: APiQypIyKzSse80LVpmHpeuit21G+MILoUKK1u3daepuG1SJPqtosG5tA6jKcRAUwgj0rSYUdn6h X-Received: by 2002:a4a:2cc6:: with SMTP id o189mr711491ooo.20.1585786444194; Wed, 01 Apr 2020 17:14:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585786444; cv=none; d=google.com; s=arc-20160816; b=CRxfaYcC9+AB+b5RJPvKQ/ZdLxV9u3YTSU3DvZb/ot/blI/SftcRUOgMuqNXctEvYy 6va/tx73ONpDAmwiCyJtumNhvR+oOweidc/oSGojXBML7hWixUCDoSkiWPi6FYom6I3N nCxYrNVorBbd3HjdLsTxwSbPG2qdYuhtZXmtJGhyYTm5N2BUQBC+BBdaCXju1hy6w8KA vhKtNfIXx5wzg8eHRzW+BPH1HEOQIEUDWxY4Dvp7oYErfxSgFUENcVV/UYPqEI3/mSsI VSRQG4emdx2n3NwZHLvvicw4Kwyl42PHae7HdAm7eyN3Nt2xqMDI81O1KAIPSQDn96SR 3vJg== 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=obZCc6hC/3mgSVPn9aN9g0OGhmjWpS0VPWYMmaF2s3k=; b=yirqI5XP20Cqh0bpMcPIdpU9UJkFKWxc1lZt3qUg7qz55Yt+GQzm/tOOZuZ+AC35JA 4fejL83Jj+am1WKu7K6t2KzlyuGzoBmKcLYPgetlBkterJD+PZbebD8ohIz1vwW8JgaR FGHYpqydoclGLTQJ4BnqjT3NwaukyvI3Ax4XtMOEmPf++do+CjhVXu+qDUvVDhU3PJW6 kTTX5buZTlfEJ9dl2qa6Is/J7bP4VU58tlAx7FhYfmi6hgZANjL7HnZBei8HWfz4eRNH N6J85LH3QKzodckFaj/Cth0HwWha7tVXlGVFHox614HyvaOvdvlcYs70XFeV70i3DOFj fRWg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10si1720209oif.30.2020.04.01.17.13.52; Wed, 01 Apr 2020 17:14:04 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1733186AbgDBANO (ORCPT + 99 others); Wed, 1 Apr 2020 20:13:14 -0400 Received: from a3.inai.de ([88.198.85.195]:45924 "EHLO a3.inai.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732137AbgDBANO (ORCPT ); Wed, 1 Apr 2020 20:13:14 -0400 Received: by a3.inai.de (Postfix, from userid 25121) id 872F158730CF4; Thu, 2 Apr 2020 02:13:12 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by a3.inai.de (Postfix) with ESMTP id 7F1FA60D9EBE3; Thu, 2 Apr 2020 02:13:12 +0200 (CEST) Date: Thu, 2 Apr 2020 02:13:12 +0200 (CEST) From: Jan Engelhardt To: "Kaneda, Erik" cc: "Rafael J. Wysocki" , "Moore, Robert" , "Wysocki, Rafael J" , ACPI Devel Maling List , Linux Kernel Mailing List Subject: RE: [PATCH] acpica: clear global_lock bits at FACS initialization In-Reply-To: Message-ID: References: <20200330085852.31328-1-jengelh@inai.de> 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 Wednesday 2020-04-01 23:55, Kaneda, Erik wrote: > >I've been reading the ACPI spec and there's nothing stated about what the >initial state of the lock should be... This patch is assuming that the lock should >be free when the FACS is being initialized and I don't think this is a safe >assumption to make. > >What if this is a legitimate acquisition by an SMI handler very early in OS boot? Before the OS has initialized ACPI (which, to me, is best recognized by what action the power button will cause - either instant-off or ACPI event), I would imagine that there are no SMI handlers that try to make use of ACPI features like the FACS lock. Furthermore, if the OS has taken the FACS lock and an SMI happens, what would the SMI do if it cannot obtain the lock? It certainly can't busywait for the OS, because that's interrupted.. >> > When the firmware ROM supplies a FACS table with garbage, and the >> > firmware code does not clear the global_lock field before booting to a >> > loader/OS, the garbage bytes in that field (like 0xffffffff) can >> > indicate that the lock is taken when it is not, thereby preventing >> > obtaining said lock even though it is otherwise perfectly usable if >> > the field were not prepopulated with garbage. > >How do we know that the lock is taken when it is not? We don't. ACPI does not make itself look good in this instance I am afraid.