Received: by 2002:a17:90a:88:0:0:0:0 with SMTP id a8csp15948pja; Fri, 22 Nov 2019 02:50:59 -0800 (PST) X-Google-Smtp-Source: APXvYqz8pefeO1xAQG+WuenTpQlkgKYD2NTUfk5KafGTbQJKlF+61naxVCFgzuPLyjPf/btGq8ID X-Received: by 2002:a17:906:9148:: with SMTP id y8mr6935801ejw.57.1574419859557; Fri, 22 Nov 2019 02:50:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574419859; cv=none; d=google.com; s=arc-20160816; b=dnxycEfgQc3yzRvzzOsmJczcWeUn+7MU5sjGihdGPLntpAYgl7pHsZi/rVFxQX5OK/ heGLVULh6HvTo2/GoCQshuBQfBM92Xf37nV4mAU+txvy0JULPCMNFqNXJNE9z3jMsG/T R+zRvS++0TQXP2L/Ax1E2ZW8TBxF8cK2uUIoo73E2dE7La9suyL/dFFQpmKiSJ8nNfXd 2stxMbQpdniAKSn0kNyxgadgHfdNAV2u1NECcFCNNQGda8MFKvN+JufHe2Prfe7sKs/f QC5fLokC+xUTByg18l3x1QlYt65jXZp036XaaUBD3AN9+h4WRksicEi0DFY2/XKDiOYA u6xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=3InUPBYKke/rT8qd84GjD4eNzSq5ebHo/jSVVjkYKOA=; b=AxpOp2z+g892Ifpi8/w/iR7/n5oMuc+gkoSVHKpkYaygNZdWyBJCcVDBFPC+Tr7+nj f3lBP07I1fCgPVVfmY5mGRkw1k3qa2R5Iz8uVl2NFeQ2c6oTORkmKZ8/Q6c1LFkGanLT IAMyVOzgqncr1GGieelPTtcrwUikLI1S82yUsiFfbVO+5UH/t19gHG0QdxLtOBY8pwJy jyyOkHXqzY684eRIgoPw2Oo2Xdx6nRmvMoUqtB+Ygaj563cllOgA5hzXK5+4SJz83+0W OzYHQExM1Jy7jPmRsVsmUA7C5Pw7433y6TOw3/IgQD0mDBRlWGn8byLBgmBc0I+JWv0r AsYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=nGwhZFb7; 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 x4si1085648ejs.376.2019.11.22.02.50.34; Fri, 22 Nov 2019 02:50:59 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=nGwhZFb7; 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 S1729702AbfKVKqy (ORCPT + 99 others); Fri, 22 Nov 2019 05:46:54 -0500 Received: from mail.kernel.org ([198.145.29.99]:54370 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729695AbfKVKqw (ORCPT ); Fri, 22 Nov 2019 05:46:52 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A241C20637; Fri, 22 Nov 2019 10:46:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574419612; bh=3q8u0klQBwS/SXsgHA9M3plNrZgWLC6kftn5zeoaxME=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nGwhZFb7cp9/yw025RqbX/5yRoXp2KsssWtUwPGOIpob1kXiGaQJJfC1IUA+VDBGO m/BbL0aOXpEzDtgQwp0YQgrHZeZdYuNh9EriRw3Mp1/ZEW2AXyy/xSTtI/kMU7b3re ihTIiFUQv1vc6sZqKZRJFFPg6JqTf2kLN+Ahx8V4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Naveen N. Rao" , Michael Ellerman , Sasha Levin Subject: [PATCH 4.9 173/222] powerpc/pseries: Fix how we iterate over the DTL entries Date: Fri, 22 Nov 2019 11:28:33 +0100 Message-Id: <20191122100914.969780014@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191122100830.874290814@linuxfoundation.org> References: <20191122100830.874290814@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Naveen N. Rao [ Upstream commit 9258227e9dd1da8feddb07ad9702845546a581c9 ] When CONFIG_VIRT_CPU_ACCOUNTING_NATIVE is not set, we look up dtl_idx in the lppaca to determine the number of entries in the buffer. Since lppaca is in big endian, we need to do an endian conversion before using this in our calculation to determine the number of entries in the buffer. Without this, we do not iterate over the existing entries in the DTL buffer properly. Fixes: 7c105b63bd98 ("powerpc: Add CONFIG_CPU_LITTLE_ENDIAN kernel config option.") Signed-off-by: Naveen N. Rao Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin --- arch/powerpc/platforms/pseries/dtl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/pseries/dtl.c b/arch/powerpc/platforms/pseries/dtl.c index 37de83c5ef172..7a4d172c93765 100644 --- a/arch/powerpc/platforms/pseries/dtl.c +++ b/arch/powerpc/platforms/pseries/dtl.c @@ -185,7 +185,7 @@ static void dtl_stop(struct dtl *dtl) static u64 dtl_current_index(struct dtl *dtl) { - return lppaca_of(dtl->cpu).dtl_idx; + return be64_to_cpu(lppaca_of(dtl->cpu).dtl_idx); } #endif /* CONFIG_VIRT_CPU_ACCOUNTING_NATIVE */ -- 2.20.1