{"id":2220919,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2220919/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/78feef3c4670f9de041e7e835b4451d42eb2d39a.1775648406.git.ritesh.list@gmail.com/","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/1.1/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/"},"msgid":"<78feef3c4670f9de041e7e835b4451d42eb2d39a.1775648406.git.ritesh.list@gmail.com>","date":"2026-04-08T12:01:37","name":"[RFC,v2,07/10] 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/1.1/people/79126/?format=json","name":"Ritesh Harjani (IBM)","email":"ritesh.list@gmail.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/78feef3c4670f9de041e7e835b4451d42eb2d39a.1775648406.git.ritesh.list@gmail.com/mbox/","series":[{"id":499129,"url":"http://patchwork.ozlabs.org/api/1.1/series/499129/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/list/?series=499129","date":"2026-04-08T12:01:30","name":"pseries/papr-hvpipe: Fix deadlock, races and misc cleanups","version":2,"mbox":"http://patchwork.ozlabs.org/series/499129/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2220919/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2220919/checks/","tags":{},"headers":{"Return-Path":"\n <linuxppc-dev+bounces-19503-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=gT4Qlp9t;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=lists.ozlabs.org\n (client-ip=2404:9400:21b9:f100::1; helo=lists.ozlabs.org;\n envelope-from=linuxppc-dev+bounces-19503-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::436\"","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=gT4Qlp9t;\n\tdkim-atps=neutral","lists.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com\n (client-ip=2607:f8b0:4864:20::436; helo=mail-pf1-x436.google.com;\n envelope-from=ritesh.list@gmail.com; receiver=lists.ozlabs.org)"],"Received":["from lists.ozlabs.org (lists.ozlabs.org\n [IPv6:2404:9400:21b9:f100::1])\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 4frMBt2j7Rz1xv0\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 08 Apr 2026 22:02:46 +1000 (AEST)","from boromir.ozlabs.org (localhost [127.0.0.1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4frMBT1v4Zz2ywy;\n\tWed, 08 Apr 2026 22:02:25 +1000 (AEST)","from mail-pf1-x436.google.com (mail-pf1-x436.google.com\n [IPv6:2607:f8b0:4864:20::436])\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 4frMBS3t6Lz2xc8\n\tfor <linuxppc-dev@lists.ozlabs.org>; Wed, 08 Apr 2026 22:02:24 +1000 (AEST)","by mail-pf1-x436.google.com with SMTP id\n d2e1a72fcca58-82cebbdab08so4399251b3a.2\n        for <linuxppc-dev@lists.ozlabs.org>;\n Wed, 08 Apr 2026 05:02:24 -0700 (PDT)","from Mac.localdomain ([49.205.216.49])\n        by smtp.gmail.com with ESMTPSA id\n d2e1a72fcca58-82cf9b3e169sm21209322b3a.18.2026.04.08.05.02.18\n        (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);\n        Wed, 08 Apr 2026 05:02:20 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1775649745;\n\tcv=none;\n b=fnP8NyE2CkWKC+dvsrYRIomlkWPng1ceVQpbZ7FRIL/uRNnWoMnExJbI4UzkRFxw8HqsJKyUkO+iXEC+bacYzlgUOL1gN/lvg2oLcTc0fANdOFAthUY77aS54qZZ9PzcBoNe2sXqfC2hHe1lPiwLSEjpl7go9hfyRlhkVHBLH8aKAZ2Vk9BBF3kJRDxLJwAVk2TMnBe9zCYqgTK7nwVoqhKBATgxhXP9pHcLG0ZiwIVnjLyFPtZMXRMnCGAVssnJi09WKwuH+r2kZSZCeZYXX5CInanu46HiUrHwGL+cvwb/OOZoKgdhxYpSSFjMJMScKfrm7jl9ZDbFdNbymhh/6A==","ARC-Message-Signature":"i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707;\n\tt=1775649745; c=relaxed/relaxed;\n\tbh=SCwuqGPqq1xW71wkNIANtyK3Rl5bXk4EbTq6DUkJUCM=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=I3At+9j8i55ufaMemlXpbRF/AQwWkPO2h1N/sFP8QaOzUmr9CdIszUfa4XhcOLWpDxNzsuyUfVSxphEsDN6SpI4sctRtGlKVRuGjhfJ1Jb3HMvTPSof+aZ32YGBEcemoBZmHGeu3iJ79EtVBRexA8Hlqkps0zcdfyv6jrwrQJnxdjA53LPBI49QZSCcjOyL5gdOwTacvGvz5uCwursYUFHYIpzz02OZ8zvky6ydRG68DiZKWmhRde+8CUVmJ4mHYHOnox9KyZ/3udeti0tAauFq5ZfcM9ON5hjAVR9gDZUBIvDUGkfHuKEVLdFymbdhPFhW1JuUPEM6DF4msUNvRAw==","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=gT4Qlp9t; dkim-atps=neutral;\n spf=pass (client-ip=2607:f8b0:4864:20::436; helo=mail-pf1-x436.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=1775649742; x=1776254542;\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=SCwuqGPqq1xW71wkNIANtyK3Rl5bXk4EbTq6DUkJUCM=;\n        b=gT4Qlp9tttlq9//QlEbAmVWh/wcdCTEv8UFcf0TREQ72UrH/CGa0R/QoGpwvl/XkoT\n         uBdjFiD1sdGfpKtmhn98fWV+0LGAWg6IvjaK8O6LmKd4rla/19I7ht4N7900PpqcR8rm\n         d/Bv4dtI6Vmp1UVpBluA4NMY/u0GHGaoiBRfEgvexq2KPCWhhg1PQm0taBosL2msruie\n         f4oDBkwjSzRuS+Z2+dhMP9UT3dsgu/AQh/EXNhFKPYyUfsMO1CPBhBKLGRImvCaIiy87\n         BPtpsRYPvYJd15V2ZZoFZmFN/1+Tl15+VL3F/q/gaH/cK+w+tQdHkwj8XCu4W+eL+8zj\n         Fy3Q==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1775649742; x=1776254542;\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=SCwuqGPqq1xW71wkNIANtyK3Rl5bXk4EbTq6DUkJUCM=;\n        b=jK6w3+lsDJblYssZbe28zfs3ENhwbLx99Sro+km4/QX6A4FLCNkbKyJdL3qQvReltt\n         dN8E4WjAzsbipW6mapyNXEVAIQ3vg1iJPs8H97WvGjhIXOFxvGDeJA+/iBpwIWsUbL8d\n         KumWKESkcB630iYim40pFnqfz9kiHvSciQ/1cTio6l3BzekINgQxVHCF2MaxvunmCWdy\n         JpMkIKzgu+gaBUrYDAdiy4/mE3fA62Ty0oKHTOu6fdf+J0Sax9Z55xMXvmkZjKUVq1iM\n         BrQWzPPNpY8DkQiPJ8QgLgNe1Z6EcmPXv+mvP5YAdwn5NHmfbCZl9WZ1t6gLW4qGaKnp\n         yZVw==","X-Gm-Message-State":"AOJu0Yy/d+uuM/PFI/os6IshoC1RPY1OpUgtKyD//4e0sJVFx3GHncLK\n\tujV+2UfLTwoCPk48xmmrL9jb65VMZFNUplZPPBsohFhswH4bY4vdnJy41HLUdQ==","X-Gm-Gg":"AeBDieuK9FtuzYnDDfV2e4yaIWYNBWwQwT0YXaGPBNv6rGS+KQbsmT08nQsW0G9DfAi\n\tVDKdisplTdSvmxRyJ+wFkod9lTRJWHM2Ro0uaHNqEN0JmhtfrutitA/QwhNYhvtXCrxqdzfQlca\n\tTJb5HZp9cuK13M6vG23yB6HyHsDiDaOXhtTRCD94o3+vI8K0mPObxONjg1DrwhEU/38G34VO+0Q\n\thP3NdYhRCvImtdPC2Cv1dccGLJEPKU5X1RVPRbQ7R/DAIc2iM9eFZIYocKBjxnqKVJSUcoLZO35\n\tJ9Zv96PlHViobdua19/Lxm3fwFiGe7N2+PxkEag78fdp+dLdGW5xM+CPT5oQ312uDZYfJKUtB+h\n\tOmzXEvTp+V8EzOlc7B3MD3Sdfm1fexvfVRS2SPI0D29N4ABZ3GSA0AT3Oj0ayHz/jpV0//QDIvH\n\tf8Lc8jitJb7mgxQx09QWUgxVqGEfjnuEuqDqf/9v3c6cJU","X-Received":"by 2002:a05:6a00:8e09:b0:827:3e19:574a with SMTP id\n d2e1a72fcca58-82d0db97457mr21444881b3a.42.1775649741673;\n        Wed, 08 Apr 2026 05:02:21 -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":"[RFC v2 07/10] pseries/papr-hvpipe: Refactor and simplify\n hvpipe_rtas_recv_msg()","Date":"Wed,  8 Apr 2026 17:31:37 +0530","Message-ID":"\n <78feef3c4670f9de041e7e835b4451d42eb2d39a.1775648406.git.ritesh.list@gmail.com>","X-Mailer":"git-send-email 2.50.1","In-Reply-To":"<cover.1775648406.git.ritesh.list@gmail.com>","References":"<cover.1775648406.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 41958ed8ee97..ac2c4b42b373 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":["RFC","v2","07/10"]}