{"id":2220913,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2220913/?format=json","web_url":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/54c52b89a626627aa57191b67a3ee22710b46f7f.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":"<54c52b89a626627aa57191b67a3ee22710b46f7f.1775648406.git.ritesh.list@gmail.com>","date":"2026-04-08T12:01:31","name":"[RFC,v2,01/10] pseries/papr-hvpipe: Fix race with interrupt handler","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"a49a2b25deb64bdcab5e8e2e06691b8762d503e2","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/54c52b89a626627aa57191b67a3ee22710b46f7f.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/2220913/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2220913/checks/","tags":{},"headers":{"Return-Path":"\n <linuxppc-dev+bounces-19497-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=VKMJ0UQ+;\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-19497-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::42d\"","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=VKMJ0UQ+;\n\tdkim-atps=neutral","lists.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gmail.com\n (client-ip=2607:f8b0:4864:20::42d; helo=mail-pf1-x42d.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 4frMB44YFGz1xv0\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 08 Apr 2026 22:02:04 +1000 (AEST)","from boromir.ozlabs.org (localhost [127.0.0.1])\n\tby lists.ozlabs.org (Postfix) with ESMTP id 4frMB14PDhz2ynf;\n\tWed, 08 Apr 2026 22:02:01 +1000 (AEST)","from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com\n [IPv6:2607:f8b0:4864:20::42d])\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 4frMB06LLCz2xc8\n\tfor <linuxppc-dev@lists.ozlabs.org>; Wed, 08 Apr 2026 22:02:00 +1000 (AEST)","by mail-pf1-x42d.google.com with SMTP id\n d2e1a72fcca58-82cf636dac8so2851611b3a.3\n        for <linuxppc-dev@lists.ozlabs.org>;\n Wed, 08 Apr 2026 05:02:00 -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.01.54\n        (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);\n        Wed, 08 Apr 2026 05:01:57 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1775649721;\n\tcv=none;\n b=c7vXU9BSaCjFVgjHEABGCt0K4TvDd4TG6wPhnMOSXDWWWZTr/FhwA3ihXhQUq8BshlVG6JXTQTsVmSr1e7EEbEzolavPwmvycNqJOUtw/EeTJTHrPJeBx1UdSbg0SysJ8U6Ne9EfPCB4JbipwrLF4eseCts7FTB5Xje36jpiHkp2KeEhOiOA1oGByJ0bpoTrxZ3eQWpB1LG2mPEqEI/eW/5h6wNpsfXUpFrfvVLL+N7IbH2eXyRaviik4F9nmlU8OJFtmL35Kw3Y6Op0MaPT/ZSCazFbIUpK32wccky5U1SxkL7ez6nERDBOCA6m3lZy5NpAa9r75/PnY/gq9vGxuA==","ARC-Message-Signature":"i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707;\n\tt=1775649721; c=relaxed/relaxed;\n\tbh=PYNm6J9AhUQ6HT8V6B6W7Iuh7E+aasxrExqJ2exyz7U=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=LArZEXhsneAzGRmzbVk2rj/KpdLxFzQF5jgHUwD9tkOcUzlH8957gQTCT6VL2Hb8sBxMnZyl99cj5CW78eB3kH+bwcv9Ma+VPCyQ7KT01NPEgtfLz/T1BDd4RdseYevi+/f+yBxrGbTcvOxpzHkNGaYF0xE00Oq22lSSrCJZ43QU6B7iRZejNbA+RnWxAGH8bnmuvDmstblc7/QISUWIKLYbHz3b61M2MoRDNiqGbOfNnDdqg+fLz5itPT7aLx4ZdbEtTpMIal8hzFHF6lVNR2A8YXTl0NoC6Mg9iEWu9eaIzJE+Y1NRP22anbVy7ISJgf1el2lwSnrPgXl+KHEx0Q==","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=VKMJ0UQ+; dkim-atps=neutral;\n spf=pass (client-ip=2607:f8b0:4864:20::42d; helo=mail-pf1-x42d.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=1775649718; x=1776254518;\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=PYNm6J9AhUQ6HT8V6B6W7Iuh7E+aasxrExqJ2exyz7U=;\n        b=VKMJ0UQ+2UORNL7CouFZrGNEcwQAoWVyknK/No4LqUrC92NF/EcJ8nRleuTN/4J40T\n         8pM3Aq7U/JFRH9044R3v1CKlBLyed/cZSQSKxUWeFfQ1WjTk5sSpGskQUQJXVuW1vGAZ\n         8cXd+ysMOcQ8gKTqAI2xmwoF7YdZstyH0qYJ7uon7O9vVzy1qTJdOg3Cd45v2AN5CJTm\n         7PU8nXXeo7aotUF7U4AibX0+NgLnfeKBwVcDcWPCuekIZeILDgB5qtTk63Ku+ckrL6xT\n         i5m+eeZWqFi/VWGojwSsfdNRM7l13H7UeiYIkRSrTtRAfeY6ZTcncmoc/Z4qFWPv0r2w\n         Mi+w==","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n        d=1e100.net; s=20251104; t=1775649718; x=1776254518;\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=PYNm6J9AhUQ6HT8V6B6W7Iuh7E+aasxrExqJ2exyz7U=;\n        b=BRMC6NuDsZ3KyHICgxZAvoyyI98miUX1RDa4Vy+6IAd+/OABJC5H1W2I4WgMyaWP/M\n         0MbCGFT154cdOkzDgscsQ9kTvWILQDyYTnsCoKPoOsYS6YkPzHq2Eh7R46LeFBBjubP9\n         E0ekUEIL0jPdu7ivUCaBLx5TuArhkJDfcs4ITKREzL6Mr7aOnZf/H0q5+3hPPYGREGhR\n         fDYLymSAEclzJL2h3VtpmAvxLsV2neJ8TcS+uqzNMKsiec9VSGbro9y/fxGncJCCUNJu\n         RcBOCEHc4XCoLQdV+QcWqJQ1poZLcAzGAHl/kj/3ug/zIJwimpyPEDryrdgV2xi2MvCd\n         N7XA==","X-Gm-Message-State":"AOJu0YxlOXQBkScWrpvDUrcnfXQ0sErwVTSsdWJSika/yg+hCVhiDOmO\n\tNWB15f9uSb00FuQHmOsyVZki2fdYJmxwIESAycIB7kI2YRcGa5nDGIsPx5SOMg==","X-Gm-Gg":"AeBDievczDM1GwDNaDcLEzkrsxb8the5LEGZ86Y6157+HSlQe6r4xk7P0eo1aTUfxBu\n\tx1Dwv9mK+HZ+qAoRhtX45Hn50mVlZI3MkUoeCo8xjcn+nCsPR0MRhEL3nQvwxOHzbaifFzHRmkM\n\tPyJqvl858HAXAZqPv82DxlZEcDD4ELR1BxoFdCHS/DBo9VwMWL79yIqNMHJpZ5MrdvB+FsOaKZ4\n\tX8Ocvx5T0DD32fUbSwln5AQHPBBhs7w36LOkShRFckHnzuHhPHPU78IGRwjLHwriNEsv3manmSI\n\tEikYjrtMC0JP4cIOsonKFKPZwzUgYqegBQB/0vTqkvilYnjX4BwK/6HjlrhCr2ZMjH0zWfHstKw\n\twe3xLI/xZHz+yE0uVGEeOXkbvPCzaLPkvd/k2Wr4GUJ3OZYv7OXufMiuk07CPqFA51rTaZe+M0+\n\thDenFTRLpd7E98/I+luXCRw2tSZgWTO378hcCqJg0yPS5n","X-Received":"by 2002:a05:6a00:92a9:b0:82c:ed02:a242 with SMTP id\n d2e1a72fcca58-82d0dc05906mr20919689b3a.52.1775649718138;\n        Wed, 08 Apr 2026 05:01:58 -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>,\n\tstable@vger.kernel.org","Subject":"[RFC v2 01/10] pseries/papr-hvpipe: Fix race with interrupt handler","Date":"Wed,  8 Apr 2026 17:31:31 +0530","Message-ID":"\n <54c52b89a626627aa57191b67a3ee22710b46f7f.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,SPF_HELO_NONE,SPF_PASS\n\tautolearn=disabled version=4.0.1 OzLabs 8","X-Spam-Checker-Version":"SpamAssassin 4.0.1 (2024-03-25) on lists.ozlabs.org"},"content":"While executing ->ioctl handler or ->release handler, if an interrupt\nfires on the same cpu, then we can enter into a deadlock.\n\nThis patch fixes both these handlers to take spin_lock_irq{save|restore}\nversions of the lock to prevent this deadlock.\n\nCc: stable@vger.kernel.org\nFixes: 814ef095f12c9 (\"powerpc/pseries: Add papr-hvpipe char driver for HVPIPE interfaces\")\nSigned-off-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>\n---\n arch/powerpc/platforms/pseries/papr-hvpipe.c | 20 +++++++++++---------\n 1 file changed, 11 insertions(+), 9 deletions(-)","diff":"diff --git a/arch/powerpc/platforms/pseries/papr-hvpipe.c b/arch/powerpc/platforms/pseries/papr-hvpipe.c\nindex 14ae480d060a..c41d45e1986d 100644\n--- a/arch/powerpc/platforms/pseries/papr-hvpipe.c\n+++ b/arch/powerpc/platforms/pseries/papr-hvpipe.c\n@@ -444,13 +444,14 @@ static int papr_hvpipe_handle_release(struct inode *inode,\n \t\t\t\tstruct file *file)\n {\n \tstruct hvpipe_source_info *src_info;\n+\tunsigned long flags;\n \n \t/*\n \t * Hold the lock, remove source from src_list, reset the\n \t * hvpipe status and release the lock to prevent any race\n \t * with message event IRQ.\n \t */\n-\tspin_lock(&hvpipe_src_list_lock);\n+\tspin_lock_irqsave(&hvpipe_src_list_lock, flags);\n \tsrc_info = file->private_data;\n \tlist_del(&src_info->list);\n \tfile->private_data = NULL;\n@@ -461,10 +462,10 @@ static int papr_hvpipe_handle_release(struct inode *inode,\n \t */\n \tif (src_info->hvpipe_status & HVPIPE_MSG_AVAILABLE) {\n \t\tsrc_info->hvpipe_status = 0;\n-\t\tspin_unlock(&hvpipe_src_list_lock);\n+\t\tspin_unlock_irqrestore(&hvpipe_src_list_lock, flags);\n \t\thvpipe_rtas_recv_msg(NULL, 0);\n \t} else\n-\t\tspin_unlock(&hvpipe_src_list_lock);\n+\t\tspin_unlock_irqrestore(&hvpipe_src_list_lock, flags);\n \n \tkfree(src_info);\n \treturn 0;\n@@ -480,20 +481,21 @@ static const struct file_operations papr_hvpipe_handle_ops = {\n static int papr_hvpipe_dev_create_handle(u32 srcID)\n {\n \tstruct hvpipe_source_info *src_info __free(kfree) = NULL;\n+\tunsigned long flags;\n \n-\tspin_lock(&hvpipe_src_list_lock);\n+\tspin_lock_irqsave(&hvpipe_src_list_lock, flags);\n \t/*\n \t * Do not allow more than one process communicates with\n \t * each source.\n \t */\n \tsrc_info = hvpipe_find_source(srcID);\n \tif (src_info) {\n-\t\tspin_unlock(&hvpipe_src_list_lock);\n+\t\tspin_unlock_irqrestore(&hvpipe_src_list_lock, flags);\n \t\tpr_err(\"pid(%d) is already using the source(%d)\\n\",\n \t\t\t\tsrc_info->tsk->pid, srcID);\n \t\treturn -EALREADY;\n \t}\n-\tspin_unlock(&hvpipe_src_list_lock);\n+\tspin_unlock_irqrestore(&hvpipe_src_list_lock, flags);\n \n \tsrc_info = kzalloc_obj(*src_info, GFP_KERNEL_ACCOUNT);\n \tif (!src_info)\n@@ -510,18 +512,18 @@ static int papr_hvpipe_dev_create_handle(u32 srcID)\n \t\treturn fdf.err;\n \n \tretain_and_null_ptr(src_info);\n-\tspin_lock(&hvpipe_src_list_lock);\n+\tspin_lock_irqsave(&hvpipe_src_list_lock, flags);\n \t/*\n \t * If two processes are executing ioctl() for the same\n \t * source ID concurrently, prevent the second process to\n \t * acquire FD.\n \t */\n \tif (hvpipe_find_source(srcID)) {\n-\t\tspin_unlock(&hvpipe_src_list_lock);\n+\t\tspin_unlock_irqrestore(&hvpipe_src_list_lock, flags);\n \t\treturn -EALREADY;\n \t}\n \tlist_add(&src_info->list, &hvpipe_src_list);\n-\tspin_unlock(&hvpipe_src_list_lock);\n+\tspin_unlock_irqrestore(&hvpipe_src_list_lock, flags);\n \treturn fd_publish(fdf);\n }\n \n","prefixes":["RFC","v2","01/10"]}