Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp3203180rdb; Tue, 26 Dec 2023 22:28:17 -0800 (PST) X-Google-Smtp-Source: AGHT+IH7vTz5lJhUYVfn9mTVvKzne0XVZJ4QziPJEzXWbKwn+Ow8WgxotojXXBJ1U2U/XQP5vK3y X-Received: by 2002:a05:6358:2786:b0:174:f648:f9c0 with SMTP id l6-20020a056358278600b00174f648f9c0mr2824339rwb.27.1703658497299; Tue, 26 Dec 2023 22:28:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703658497; cv=none; d=google.com; s=arc-20160816; b=KfG//XcQJsWBf/iT61PoNWh/NDCc3/xDPAj665JQKUr6sHnr7IRi5PYOxvImUF+SDo zmJ8XLzbxKW1/kHvdUkmoJYMSqeWC94sK9c5mTv4xhIuVmMY4iqWZPCLG+KgoP7rRQR8 kbuaP07pAf7K1WGRPSNx73H1Z1krIj/5nAGaZ1sUzX1WaOBs2IMKHCARJf461eGbut0l vrmAIvExYCpq7kZa+H82daP3MgVD3xi3jelq6FQzx2BFMtmwwKvjnty7vT41V+ouANza 79hEDncCkFMGxWgZxZVo3KYj+gdktVRJe3IfGhvkXiGeWEGzlhhywTiVdq95EI2lrqt4 Ik+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-id:precedence:message-id:date :subject:cc:to:from:dkim-signature; bh=o78ogMXYTVS86z7hT4SZBlW/ORP+cHYnEDOGyPN/o4w=; fh=CBQlqOvF9fyboxqAZJM4TZBrjqoevz5hhSzcPNkjfiQ=; b=oP4x0oK9pGbhjrJBVPAppM97y7KbPUWxGh3vd1Zt6hi+rOuBTwKc1fN0NPlL0f9idN K+VdEPuKGpxXWaEJ5O0IN+g0S2LVSrYS+9N1Yc9F0ySgzcv3eMC4pgmout4hWtqLSuZ6 vM6GYJ/oJACdSPNM603V3AVmqjPdNStP+JWtwa7VsnQEcix3naL7psjRB0+6pUKIDCZK Sh0OxLds/WV8kURxYKz7gnL6V9BDYQohuOHrMxxM57DDHVB+DFFrY+HTlr/jx+Baq9uH s7SGrzhBKHvSEHqzJpPXD4kHh7GIV97rQ0Y9qq50tnjAbH6pxWRHsK5fJmxthSqI2bRu bw8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kxc8sU71; spf=pass (google.com: domain of linux-kernel+bounces-11858-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11858-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id k187-20020a633dc4000000b005cd966560absi10832113pga.680.2023.12.26.22.28.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Dec 2023 22:28:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-11858-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=kxc8sU71; spf=pass (google.com: domain of linux-kernel+bounces-11858-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-11858-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.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 D4E04B224D8 for ; Wed, 27 Dec 2023 06:28:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D73165392; Wed, 27 Dec 2023 06:28:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="kxc8sU71" X-Original-To: linux-kernel@vger.kernel.org Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.88]) (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 078075666; Wed, 27 Dec 2023 06:28:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1703658481; x=1735194481; h=from:to:cc:subject:date:message-id; bh=suBVpZrIX+26A1y1ne4PDB74bdL7C3LwazkehHNtqYs=; b=kxc8sU71AVh2l8de40/YCvbZf3UzME2g04h9aNGVtcxlCzqCkdV5aIP+ l//1Y6jbP+muy6pgyP4SB53rhSQ7/3sZZAzcvQ3XA4SHkO6SZDhrKGUFd Vx8YQJeYmNFGBOJq9MS3x9jS9Ns8QuJlOQLZhcGOz/xnRKSYEudUUc7Px UGhonHARNhjczyu/HXfcluQtSLvYvdtzLaQ9YLk2GcBQ6d8b3sHNzMapa coxrMfiZZ6a5Tvi5aPo4COrzAxX4sIbRR0tpKQkhOl+Gaj0kf4bFehbg8 OXbObHsRTEXdfB3cKzySrUhgz71hlcaYcO3XME3VohJN23/DzOURZGdOR g==; X-IronPort-AV: E=McAfee;i="6600,9927,10935"; a="427584069" X-IronPort-AV: E=Sophos;i="6.04,308,1695711600"; d="scan'208";a="427584069" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Dec 2023 22:28:00 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10935"; a="1025316079" X-IronPort-AV: E=Sophos;i="6.04,308,1695711600"; d="scan'208";a="1025316079" Received: from ranerica-svr.sc.intel.com ([172.25.110.23]) by fmsmga006.fm.intel.com with ESMTP; 26 Dec 2023 22:27:59 -0800 From: Ricardo Neri To: "Rafael J. Wysocki" Cc: Chen Yu , Len Brown , Srinivas Pandruvada , Stanislaw Gruszka , Zhang Rui , Zhao Liu , stable@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Ricardo Neri Subject: [PATCH 0/4] thermal: intel: hfi: Fix memory corruption on resume from hibernation Date: Tue, 26 Dec 2023 22:29:36 -0800 Message-Id: <20231227062940.10780-1-ricardo.neri-calderon@linux.intel.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Hi, Memory corruption may occur if the location of the HFI memory buffer is not restored when resuming from hibernation or suspend-to-memory. During a normal boot, the kernel allocates a memory buffer and gives it to the hardware for reporting updates in the HFI table. The same allocation process is done by a restore kernel when resuming from suspend or hibernation. The location of the memory that the restore kernel allocates may differ from that allocated by the image kernel. To prevent memory corruption (the hardware keeps using the memory buffer from the restore kernel), it is necessary to disable HFI before transferring control to the image kernel. Once running, the image kernel must restore the location of the HFI memory and enable HFI. The patchset addresses the described bug on systems with one or more HFI instances (i.e., packages) using CPU hotplug callbacks and a suspend notifier. I tested this patchset on Meteor Lake and Sapphire Rapids. The systems completed 3500 (in two separate tests of 1500 and 2000 repeats) and 1000 hibernate-resume cycles, respectively. I tested it using Rafael's testing branch as on 20th December 2023. Thanks and BR, Ricardo Ricardo Neri (4): thermal: intel: hfi: Refactor enabling code into helper functions thermal: intel: hfi: Enable an HFI instance from its first online CPU thermal: intel: hfi: Disable an HFI instance when all its CPUs go offline thermal: intel: hfi: Add a suspend notifier drivers/thermal/intel/intel_hfi.c | 142 ++++++++++++++++++++++++------ 1 file changed, 116 insertions(+), 26 deletions(-) -- 2.25.1