{"id":2231667,"url":"http://patchwork.ozlabs.org/api/patches/2231667/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/bbe7ddf8b8e25c9be8fc5e2c4aea9e5fca128bf4.1777606826.git.ritesh.list@gmail.com/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/","list_archive_url":"https://lore.kernel.org/linuxppc-dev/","list_archive_url_format":"https://lore.kernel.org/linuxppc-dev/{}/","commit_url_format":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/commit/?id={}"},"msgid":"<bbe7ddf8b8e25c9be8fc5e2c4aea9e5fca128bf4.1777606826.git.ritesh.list@gmail.com>","list_archive_url":"https://lore.kernel.org/linuxppc-dev/bbe7ddf8b8e25c9be8fc5e2c4aea9e5fca128bf4.1777606826.git.ritesh.list@gmail.com/","date":"2026-05-01T04:11:47","name":"[v3,8/9] pseries/papr-hvpipe: Refactor and simplify hvpipe_rtas_recv_msg()","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"3f6a697413e2e465b9349137cb527b23559f53e6","submitter":{"id":79126,"url":"http://patchwork.ozlabs.org/api/people/79126/?format=json","name":"Ritesh Harjani (IBM)","email":"ritesh.list@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/bbe7ddf8b8e25c9be8fc5e2c4aea9e5fca128bf4.1777606826.git.ritesh.list@gmail.com/mbox/","series":[{"id":502420,"url":"http://patchwork.ozlabs.org/api/series/502420/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=502420","date":"2026-05-01T04:11:39","name":"pseries/papr-hvpipe: Fix deadlock, races and misc cleanups","version":3,"mbox":"http://patchwork.ozlabs.org/series/502420/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2231667/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2231667/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linuxppc-dev+bounces-20359-incoming=patchwork.ozlabs.org@lists.ozlabs.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linuxppc-dev@lists.ozlabs.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=g/4Aem5I;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=112.213.38.117; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev+bounces-20359-incoming=patchwork.ozlabs.org@lists.ozlabs.org;\n receiver=patchwork.ozlabs.org)","lists.ozlabs.org;\n arc=none smtp.remote-ip=\"2607:f8b0:4864:20::433\"","lists.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com","lists.ozlabs.org;\n\tdkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=g/4Aem5I;\n\tdkim-atps=neutral","lists.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com\n (client-ip=2607:f8b0:4864:20::433; helo=mail-pf1-x433.google.com;\n envelope-from=ritesh.list@gmail.com; receiver=lists.ozlabs.org)"],"Received":["from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g6Hhd1660z1y04\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 01 May 2026 14:13:21 +1000 (AEST)","from boromir.ozlabs.org (localhost [127.0.0.1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4g6Hh449nsz3bgh;\n\tFri, 01 May 2026 14:12:52 +1000 (AEST)","from mail-pf1-x433.google.com (mail-pf1-x433.google.com\n [IPv6:2607:f8b0:4864:20::433])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n\t(No client certificate requested)\n\tby lists.ozlabs.org (Postfix) with ESMTPS id 4g6Hh36JG7z2xjd\n\tfor <linuxppc-dev@lists.ozlabs.org>; Fri, 01 May 2026 14:12:51 +1000 (AEST)","by mail-pf1-x433.google.com with SMTP id\n d2e1a72fcca58-82cf636dac8so776669b3a.3\n        for <linuxppc-dev@lists.ozlabs.org>;\n Thu, 30 Apr 2026 21:12:51 -0700 (PDT)","from localhost.localdomain ([49.205.216.49])\n        by smtp.gmail.com with ESMTPSA id\n d2e1a72fcca58-83515b485eesm1159428b3a.48.2026.04.30.21.12.45\n        (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);\n        Thu, 30 Apr 2026 21:12:48 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1777608772;\n\tcv=none;\n b=Ig9538x7dlwPdvic+eYKx0Vxipgd3qqaZw3GfDXX+u3SReyWDue1pjdIL10O0LJBQkPBeU4/EhrFJGCCwp/ZS8WbiiY+uD3rCiVUNJjTc8A1lyJV6DbHxq7YGvRcYnPXxyKfwNkqk0e6Jv4IgBV9BUrc1v+Tv6wJggy0FkjVXbIZC/UHxtRwqlm2w/40yd99dqnQ29odFou3BLRoKHeefsK34X0MvTYm0Pxal6Tu+YYmHuHB9jKCFDD92K4XmbU9Nex6FGAwk0JkpsPIMqUQ8sdHOqvP+L4ARdDs+2tuDZLusDLYNPSeEJ+6y3gUwtme6on5izCTe3MJnlXvuCdA4Q==","ARC-Message-Signature":"i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707;\n\tt=1777608772; c=relaxed/relaxed;\n\tbh=tmK0ukFVMjb3b7sfCs+v8o+MM2eoVKnNMBXjoF9UXgk=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=XQbemhpxZ/a2OIs2MCCQrgMCToH0g7dyAt7zG1H/F84it9SMTWyD4CQWmOx7uJ+YfFH0N/H51bouaBT0QdHrrMEONk0ST2d9aTQKdmdrheBHYxBQ+5ytJKEMdK6b4x4h/Uvf/HcqqoZAXqZaFGXa8D6MCZQvpiA6LJm826v9Bx9/0C+HhtINgbNsxKwN6Lg0TEi2kpSDSxWHD+9Ko1/8a1QdnDg5FGhSPO5mcbW8tdimrOSM7icHu0ZvCQHd4UEsDDJrpPHNGheDJ9YKZB7COStWiaVWkpZ2GUIarnkrqvcy0IatSnHWFC/O47NqLh5AQWTW56Pr0DsB5kIceNECzw==","ARC-Authentication-Results":"i=1; lists.ozlabs.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com; dkim=pass (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=g/4Aem5I; dkim-atps=neutral;\n spf=pass (client-ip=2607:f8b0:4864:20::433; helo=mail-pf1-x433.google.com;\n envelope-from=ritesh.list@gmail.com;\n receiver=lists.ozlabs.org) smtp.mailfrom=gmail.com","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=gmail.com; s=20251104; t=1777608769; x=1778213569;\n darn=lists.ozlabs.org;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n         :message-id:reply-to;\n        bh=tmK0ukFVMjb3b7sfCs+v8o+MM2eoVKnNMBXjoF9UXgk=;\n        b=g/4Aem5IBQ68qzkcE4we/KJcsqQfTWSYxg5s+HoH1SSIR0g5fZZrRfL07nwd19muqY\n         zia2ytae1gwiTO25xAvWmL/wGguCznqd+zz3vDDKmQ3QKKCPeWbRRbCL44JpHMPZbx4n\n         338DyCuyHLIUSiIR1Ar3uaB3IQR2EIIprJhZcL/ouezWa45FtBzb/QzTDT9wQGq7zQem\n         ZTj9TGfBiDzifvoLnUQggAs1E9DrQKZGmZRUF4RkRcojL5al0/DxN/swZzynDM4S63Zu\n         rbEDbt3yc2PUxCYU8OgHbHXRAqpiCvhmeSBkimc2hBm/P1phG64AXakCDybgaa2fkWr4\n         4rhQ==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1777608769; x=1778213569;\n        h=content-transfer-encoding:mime-version:references:in-reply-to\n         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n         :to:cc:subject:date:message-id:reply-to;\n        bh=tmK0ukFVMjb3b7sfCs+v8o+MM2eoVKnNMBXjoF9UXgk=;\n        b=eewOu0LSUwhK12gNsTyCLxXzJH73qa/WSLnBqpdP8CUI3Y/Od7ug7fffyCZChCdIFF\n         pDwiyETdtcYTcO7nONcDiowk8WSi4lqq1qIEExC75GJtkbqQWg0VHURCvUoSoeCMP2VL\n         pkv+VmYW18FCkj1+PxzWbj0KBgKen6Lvyq+N2t3iHPsZDBCkJTI40qtQspwVw0GjCJfp\n         zbbQbC8xvfbbwbo/RqxyMa8MNEKxdNptQp2S/p+agjKGk4T3gpXFZec6WQlsD/aeFzwq\n         j/LfOYEWj6tFuIyCB8tgAo7wLTPJeYMNmtvsHrYJULMZBB1XoNJQfH9IxsZLlP6zQdBH\n         nLiA==","X-Gm-Message-State":"AOJu0YwcCqaYt3ZreByrII9anL/RUXbBO49OAFZnTAAAip/jmtyzuHkL\n\tcyxvLcvESlW4OAfSpY2eTbubEv7bgQ8o/kkvypv6ZX5AOVM1G4oGX1Z7YeeShZZ+","X-Gm-Gg":"AeBDievydm7IUViIGoy8K2lmn9K7URmi4970xpDX7tRiv0z+9s3aBD+CeeGeS1OF6mc\n\tATY1Fi+fgpfZx6W4+5R69By6QbV9W1Y2HuzxE9H68iq9HmSG3GCRjug0wgoHECS/1xfSV54YCcx\n\tvKk7kpU7ffU8p2iUX0r6XCcjjyjFHgJWGtB1c7plF+spWwAn8g43j1hY6r7AFhxZyS3uvsXAQGX\n\tR1F2rb/pwHyYfK/bGhNONa33JBKC4MmVL9j6ZJIawjuglWyEg5jfLUUEvbUIp8yeGKIynY80K7W\n\tvih9mBtuvAofvRpvVEk7GBls3mP4bU79+awjoLTPeyvOa7iStINSl/smubabN6G62EZZHiTKVt/\n\tSh6QiH1VFbdGqKlAZMFlEcMgsDCPz9QnpG+RX78irMp3+RatbxqhOsGNaXtZqNeDijFISrJfUey\n\t83q3dXGRv/Yoxf+ZuPhEyjYT4xTz/Z/K1M0ljK3/9UR6IE8RdxEjaPUBuHpGx+1qo=","X-Received":"by 2002:a05:6a00:1ca5:b0:82f:5154:d1d9 with SMTP id\n d2e1a72fcca58-834fdb07c68mr7050443b3a.6.1777608769448;\n        Thu, 30 Apr 2026 21:12:49 -0700 (PDT)","From":"\"Ritesh Harjani (IBM)\" <ritesh.list@gmail.com>","To":"linuxppc-dev@lists.ozlabs.org,\n\tHaren Myneni <haren@linux.ibm.com>","Cc":"Madhavan Srinivasan <maddy@linux.ibm.com>,\n\tChristophe Leroy <chleroy@kernel.org>,\n\tVenkat Rao Bagalkote <venkat88@linux.ibm.com>,\n\tNicholas Piggin <npiggin@gmail.com>,\n\tlinux-kernel@vger.kernel.org,\n\t\"Ritesh Harjani (IBM)\" <ritesh.list@gmail.com>","Subject":"[PATCH v3 8/9] pseries/papr-hvpipe: Refactor and simplify\n hvpipe_rtas_recv_msg()","Date":"Fri,  1 May 2026 09:41:47 +0530","Message-ID":"\n <bbe7ddf8b8e25c9be8fc5e2c4aea9e5fca128bf4.1777606826.git.ritesh.list@gmail.com>","X-Mailer":"git-send-email 2.50.1","In-Reply-To":"<cover.1777606826.git.ritesh.list@gmail.com>","References":"<cover.1777606826.git.ritesh.list@gmail.com>","X-Mailing-List":"linuxppc-dev@lists.ozlabs.org","List-Id":"<linuxppc-dev.lists.ozlabs.org>","List-Help":"<mailto:linuxppc-dev+help@lists.ozlabs.org>","List-Owner":"<mailto:linuxppc-dev+owner@lists.ozlabs.org>","List-Post":"<mailto:linuxppc-dev@lists.ozlabs.org>","List-Archive":"<https://lore.kernel.org/linuxppc-dev/>,\n  <https://lists.ozlabs.org/pipermail/linuxppc-dev/>","List-Subscribe":"<mailto:linuxppc-dev+subscribe@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-digest@lists.ozlabs.org>,\n  <mailto:linuxppc-dev+subscribe-nomail@lists.ozlabs.org>","List-Unsubscribe":"<mailto:linuxppc-dev+unsubscribe@lists.ozlabs.org>","Precedence":"list","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Spam-Status":"No, score=-0.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID,\n\tDKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,\n\tSPF_HELO_NONE,SPF_PASS autolearn=disabled version=4.0.1 OzLabs 8","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on lists.ozlabs.org"},"content":"Simplify hvpipe_rtas_recv_msg() by removing three levels of nesting...\nif (!ret)\n    if (buf)\n\tif (size < bytes_written)\n... this refactoring of the function bails out to \"out:\" label first, in case\nof any error. This simplifies the init flow.\n\nSigned-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>\n---\n arch/powerpc/platforms/pseries/papr-hvpipe.c | 52 ++++++++++----------\n 1 file changed, 26 insertions(+), 26 deletions(-)\n\n--\n2.39.5","diff":"diff --git a/arch/powerpc/platforms/pseries/papr-hvpipe.c b/arch/powerpc/platforms/pseries/papr-hvpipe.c\nindex 46159f1c1cf1..3688b2be0445 100644\n--- a/arch/powerpc/platforms/pseries/papr-hvpipe.c\n+++ b/arch/powerpc/platforms/pseries/papr-hvpipe.c\n@@ -190,34 +190,34 @@ static int hvpipe_rtas_recv_msg(char __user *buf, int size)\n \t\treturn -ENOMEM;\n \t}\n\n-\tret = rtas_ibm_receive_hvpipe_msg(work_area, &srcID,\n-\t\t\t\t\t&bytes_written);\n-\tif (!ret) {\n-\t\t/*\n-\t\t * Recv HVPIPE RTAS is successful.\n-\t\t * When releasing FD or no one is waiting on the\n-\t\t * specific source, issue recv HVPIPE RTAS call\n-\t\t * so that pipe is not blocked - this func is called\n-\t\t * with NULL buf.\n-\t\t */\n-\t\tif (buf) {\n-\t\t\tif (size < bytes_written) {\n-\t\t\t\tpr_err(\"Received the payload size = %d, but the buffer size = %d\\n\",\n-\t\t\t\t\tbytes_written, size);\n-\t\t\t\tbytes_written = size;\n-\t\t\t}\n-\t\t\tif (copy_to_user(buf,\n-\t\t\t\t\trtas_work_area_raw_buf(work_area),\n-\t\t\t\t\tbytes_written))\n-\t\t\t\tret = -EFAULT;\n-\t\t\telse\n-\t\t\t\tret = bytes_written;\n-\t\t}\n-\t} else {\n-\t\tpr_err(\"ibm,receive-hvpipe-msg failed with %d\\n\",\n-\t\t\t\tret);\n+\t/*\n+\t * Recv HVPIPE RTAS is successful.\n+\t * When releasing FD or no one is waiting on the\n+\t * specific source, issue recv HVPIPE RTAS call\n+\t * so that pipe is not blocked - this func is called\n+\t * with NULL buf.\n+\t */\n+\tret = rtas_ibm_receive_hvpipe_msg(work_area, &srcID, &bytes_written);\n+\tif (ret) {\n+\t\tpr_err(\"ibm,receive-hvpipe-msg failed with %d\\n\", ret);\n+\t\tgoto out;\n \t}\n\n+\tif (!buf)\n+\t\tgoto out;\n+\n+\tif (size < bytes_written) {\n+\t\tpr_err(\"Received the payload size = %d, but the buffer size = %d\\n\",\n+\t\t\t\tbytes_written, size);\n+\t\tbytes_written = size;\n+\t}\n+\n+\tif (copy_to_user(buf, rtas_work_area_raw_buf(work_area), bytes_written))\n+\t\tret = -EFAULT;\n+\telse\n+\t\tret = bytes_written;\n+\n+out:\n \trtas_work_area_free(work_area);\n \treturn ret;\n }\n","prefixes":["v3","8/9"]}