From patchwork Fri Jun 24 02:45:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 12893302 Received: from mga06.intel.com (mga06b.intel.com [134.134.136.31]) (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 11CE41FCD; Fri, 24 Jun 2022 02:45:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1656038721; x=1687574721; h=date:from:to:cc:subject:message-id:references: in-reply-to:mime-version; bh=dRj4P82OnytqCwrJAeegbI/5GTXNErF9xp1XTUwfQzA=; b=aATbfq3EFCqtbbsvuh5q9Qe1N9vaZYB/ak/cKligkgMOg1973GaRFiTt elBtVKu/Vf1AvvtS1TXA0R0197Uq0N+DYnd31RbZaWL/4/e8O+psHB9ZH O0YBU1uZP1J8tuLOF/415ROSLoso7F9HwFF6MINrtv5xGFFYbPMZcIvc3 Mpm11WFCqLW1qsxOy2zCAqFKsKY2uICs5kkSTy/J9w+LaCHPOA+p/Cqca ox+P5O0ynTy8pGp58m9XHMZVSijHbBdT3/9CCm7mXYRX/uCCZ515+K9J7 vpM2B0QxSRC4/OoN2gpmLgNRH96uAsLnGWuDyzrNWTxn/f1ExBNoyVVOF w==; X-IronPort-AV: E=McAfee;i="6400,9594,10387"; a="342591741" X-IronPort-AV: E=Sophos;i="5.92,217,1650956400"; d="scan'208";a="342591741" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2022 19:45:12 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.92,217,1650956400"; d="scan'208";a="678351319" Received: from orsmsx606.amr.corp.intel.com ([10.22.229.19]) by FMSMGA003.fm.intel.com with ESMTP; 23 Jun 2022 19:45:12 -0700 Received: from orsmsx608.amr.corp.intel.com (10.22.229.21) by ORSMSX606.amr.corp.intel.com (10.22.229.19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Thu, 23 Jun 2022 19:45:12 -0700 Received: from orsmsx605.amr.corp.intel.com (10.22.229.18) by ORSMSX608.amr.corp.intel.com (10.22.229.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Thu, 23 Jun 2022 19:45:11 -0700 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx605.amr.corp.intel.com (10.22.229.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27 via Frontend Transport; Thu, 23 Jun 2022 19:45:11 -0700 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.106) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2308.27; Thu, 23 Jun 2022 19:45:11 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c1QLWKTDVnKvt7Eh5R73L0y8zM/sQh5oR0RTnfWcrflEzY9MfVsI6k60Y+Mfh/UALp+Yk7Mqx8pwHYCKMkKj3bom2sPgMSN9UZIYpMG8h45EwvIWqPisd237/EXGB5Y1YvpWP4IpoZH22XzKHYjwXO4S3lhIm6EXJlJXTqE5fmVk/TT83t3IiPboJKPxGLwk3nYdBFi5icVzRoL9l0qhheMZSQn02MHvODVusMMZeynbxrADj4k018gld2/yUUZzHsu6EN4d5ja65SosffvruGz32VYbK6wLQfi2qRXznHLOMBHPuuFdjdqqeGgUQ5LZrXqOc2XUDTdIcGfluecjcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=z9+5F/gXJ/1G9PFHiwabwJjHWmnQFfGv5UHF0uA7lNE=; b=HxJ6CqyVBM+qYZb7pwc1Z8wqJwV6uXsD2DmlgTT2v9yy5AnWVK73K3F/ZDONuk1bb6ZIaalgAuHP/oSK6qDsZDCScULU+DZTM6BNLszPsBsqJ07h9sWHpV/c/YfYo9ZLC0qFLkOdV7dX/TmEhNHTiMows4CSnviQswBmxRKUZWK98dWFV6csE4vra2UL1wapS1OahoCGWvG8M9JsOvrKpDkWjxJ0vLsP1KN9B0TgBLgkEwLHG7TpNKGKMfP1bNyRgAIvjExvlGYCzurnPji8+HSPJ9HpCw5N/Wcla5KKy7Tvn6DZpv0x431bJ0m0bsCXSfwxBX0kiGVvKxlVRFLPCA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from MWHPR1101MB2126.namprd11.prod.outlook.com (2603:10b6:301:50::20) by DM5PR11MB1993.namprd11.prod.outlook.com (2603:10b6:3:12::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5373.16; Fri, 24 Jun 2022 02:45:09 +0000 Received: from MWHPR1101MB2126.namprd11.prod.outlook.com ([fe80::f50c:6e72:c8aa:8dbf]) by MWHPR1101MB2126.namprd11.prod.outlook.com ([fe80::f50c:6e72:c8aa:8dbf%7]) with mapi id 15.20.5353.022; Fri, 24 Jun 2022 02:45:09 +0000 Date: Thu, 23 Jun 2022 19:45:07 -0700 From: Dan Williams To: CC: , , , , Subject: [PATCH 01/46] tools/testing/cxl: Fix cxl_hdm_decode_init() calling convention Message-ID: <165603870776.551046.8709990108936497723.stgit@dwillia2-xfh> References: <165603869943.551046.3498980330327696732.stgit@dwillia2-xfh> Content-Disposition: inline In-Reply-To: <165603869943.551046.3498980330327696732.stgit@dwillia2-xfh> User-Agent: StGit/0.18-3-g996c X-ClientProxiedBy: CO2PR04CA0182.namprd04.prod.outlook.com (2603:10b6:104:5::12) To MWHPR1101MB2126.namprd11.prod.outlook.com (2603:10b6:301:50::20) Precedence: bulk X-Mailing-List: nvdimm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 57c2972c-4812-4f98-2201-08da558b8df4 X-MS-TrafficTypeDiagnostic: DM5PR11MB1993:EE_ X-LD-Processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Zwo8vvfMQEwQMMYgGW5fQzNRhlAJv94HgG/tm1C8GvsASA3JEjh39UVTbghr8TyTt93FcuvJAa9rDCGdclyzO9aqUMp8rGllixoq1AD+714/9Ke2e3/MXDuga5dUuINpHrGoP9S19aAeyTTWQWiBL1/+95CKDt2vmw+GW2W6Isa+DourJHR01fmXZZ6zkOLaOzCMCnNZtWTKCfXbihTKoKTvnpg+JXhrGvT31QfsXCMswYrSix/eDqvjDDay7ozFrMXwPJOVkYKGcEvsOxT2gx6QNRxYbn/TDBGrj2f1Gl/SjdieHsKZxOTUF4QcvDtsqhkY5HcUXruMY8h9HKZ3XIn29w+yaZhSWOCaIaDOfE6s9MdgO0B6uVrvyvi6u912daLgW4ErOvLLMsvExVnUPNCyYYx8f295z7nrRkZzwLM2Y63ChlGpEc7ewe0QR+8sKkqhD7xqhd5fJkCY3Gz0Fn/UqF13KkZkXPUMxs9h6dwBwgo+yowaYmeKlJVJLLYW8C1qnKF+GjEgLKd5zxImr1jJV6ot2g+tJiaOApMugnsY8THeTW+HOlhMG2GBo5IMPAv3x6NzCZ8ky1pBtg2UX4YHmiqmcGV14Id2NWzg5MTxyDtbM9GX3Hgq3Vpd6O69+ujx7oXf25JXxY5HC50enV+6S1l9GF41rYQQ5w6w+bcg92DRp++5aLaAIzYKmRXzRWm+q2hFWNtB9RK01XqZTUaNisJlPfk3XVKFh1eXV3o= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR1101MB2126.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(7916004)(366004)(376002)(396003)(346002)(136003)(39860400002)(6506007)(6486002)(2906002)(41300700001)(478600001)(66476007)(316002)(9686003)(4326008)(103116003)(8676002)(66556008)(86362001)(33716001)(6916009)(66946007)(6512007)(26005)(83380400001)(38100700002)(8936002)(186003)(82960400001)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: l3TGmcFUQWD4z44/WE6oa4lvIj4hotjRGQAPGKPy5ktU1lbuF5IyOkkdjjq0Js52dN1T1jv+U1hGONKrQrJZFJ7lPOboSbFDAER3B0ko+60HlkuzyrKCt6GVSudf7tCUyWEDth48F2gJoV4G8D0ET+Sc9Feo2jMhD9nbLkPn/9sbST/yMCUZuyKko5Ib+1pg2/13/nKjQvG7aEud0MBJuhx4qi+WhjeFqlm6NbVxRIQO6htzFJnCHjKqBF2kyEGAdzC+8QAyZqZ0ClkjhC6Cqi3zYk//lLtUPyc+2/RV6cOWGvDPhHVgKO7Ds4Fkiohh5FO8tFJy80bRpDjm/ZdMOn629rgzP3mD4YmGR42mqbyeyg2anzjrP0VFcmlcuANnV9JWRv5Z2w5zkN94+oRT2kORL2q8litujP0wDP9+0UoT3LJtFrFW7BxTTJB1Cs+culS4NnQ0+et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h4AXZrJzAzB6aboTEXdhUP2uGKzI7NiI0cuXxyIN76co5j5+BWheApMw2svnXPiD8VeSpsTuuaZYjA== X-MS-Exchange-CrossTenant-Network-Message-Id: 57c2972c-4812-4f98-2201-08da558b8df4 X-MS-Exchange-CrossTenant-AuthSource: MWHPR1101MB2126.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Jun 2022 02:45:09.8154 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +RRNjwWsKa8ox89e4wk3x6Vqx6kdFTbq0u8FMdhC4qksUlQV/gyLjAVT2c0du/i6YEcvrj8a5F56ZDquDV3Jh8gqV/WOmwlxbXBsz1JliBg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR11MB1993 X-OriginatorOrg: intel.com This failing signature: [ 8.392669] cxl_bus_probe: cxl_port endpoint2: probe: 970997760 [ 8.392670] cxl_port: probe of endpoint2 failed with error 970997760 [ 8.392719] create_endpoint: cxl_mem mem0: add: endpoint2 [ 8.392721] cxl_mem mem0: endpoint2 failed probe [ 8.392725] cxl_bus_probe: cxl_mem mem0: probe: -6 ...shows cxl_hdm_decode_init() resulting in a return code ("970997760") that looks like stack corruption. The problem goes away if cxl_hdm_decode_init() is not mocked via __wrap_cxl_hdm_decode_init(). The corruption results from the mismatch that the calling convention for cxl_hdm_decode_init() is: int cxl_hdm_decode_init(struct cxl_dev_state *cxlds, struct cxl_hdm *cxlhdm) ...and __wrap_cxl_hdm_decode_init() is: bool __wrap_cxl_hdm_decode_init(struct cxl_dev_state *cxlds, struct cxl_hdm *cxlhdm) ...i.e. an int is expected but __wrap_hdm_decode_init() returns bool. Fix the convention and cleanup the organization to match __wrap_cxl_await_media_ready() as the difference was a red herring that distracted from finding the bug. Fixes: 92804edb11f0 ("cxl/pci: Drop @info argument to cxl_hdm_decode_init()") Signed-off-by: Dan Williams Reviewed-by: Jonathan Cameron --- tools/testing/cxl/test/mock.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/testing/cxl/test/mock.c b/tools/testing/cxl/test/mock.c index f1f8c40948c5..bce6a21df0d5 100644 --- a/tools/testing/cxl/test/mock.c +++ b/tools/testing/cxl/test/mock.c @@ -208,13 +208,15 @@ int __wrap_cxl_await_media_ready(struct cxl_dev_state *cxlds) } EXPORT_SYMBOL_NS_GPL(__wrap_cxl_await_media_ready, CXL); -bool __wrap_cxl_hdm_decode_init(struct cxl_dev_state *cxlds, - struct cxl_hdm *cxlhdm) +int __wrap_cxl_hdm_decode_init(struct cxl_dev_state *cxlds, + struct cxl_hdm *cxlhdm) { int rc = 0, index; struct cxl_mock_ops *ops = get_cxl_mock_ops(&index); - if (!ops || !ops->is_mock_dev(cxlds->dev)) + if (ops && ops->is_mock_dev(cxlds->dev)) + rc = 0; + else rc = cxl_hdm_decode_init(cxlds, cxlhdm); put_cxl_mock_ops(index);