Re: [PATCH] net: ethernet: fs_enet: Add missing MODULE_LICENSE
On Tue, Jan 05, 2021 at 01:22:29PM +1100, Michael Ellerman wrote: > Since commit 1d6cd3929360 ("modpost: turn missing MODULE_LICENSE() > into error") the ppc32_allmodconfig build fails with: > > ERROR: modpost: missing MODULE_LICENSE() in > drivers/net/ethernet/freescale/fs_enet/mii-fec.o > ERROR: modpost: missing MODULE_LICENSE() in > drivers/net/ethernet/freescale/fs_enet/mii-bitbang.o > > Add the missing MODULE_LICENSEs to fix the build. Both files include a > copyright header indicating they are GPL v2. > > Signed-off-by: Michael Ellerman > --- > drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c | 1 + > drivers/net/ethernet/freescale/fs_enet/mii-fec.c | 1 + > 2 files changed, 2 insertions(+) > > diff --git a/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c > b/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c > index c8e5d889bd81..76ac1a9eab58 100644 > --- a/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c > +++ b/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c > @@ -223,3 +223,4 @@ static struct platform_driver fs_enet_bb_mdio_driver = { > }; > > module_platform_driver(fs_enet_bb_mdio_driver); > +MODULE_LICENSE("GPL v2"); > diff --git a/drivers/net/ethernet/freescale/fs_enet/mii-fec.c > b/drivers/net/ethernet/freescale/fs_enet/mii-fec.c > index 8b51ee142fa3..407c330b432f 100644 > --- a/drivers/net/ethernet/freescale/fs_enet/mii-fec.c > +++ b/drivers/net/ethernet/freescale/fs_enet/mii-fec.c > @@ -224,3 +224,4 @@ static struct platform_driver fs_enet_fec_mdio_driver = { > }; > > module_platform_driver(fs_enet_fec_mdio_driver); > +MODULE_LICENSE("GPL v2"); Hi Michael The use of "GPL v2" has been deprecated. Please use just "GPL". There is a discussion about this here: https://lore.kernel.org/patchwork/patch/1036331/ https://www.kernel.org/doc/html/latest/process/license-rules.html#id1 Andrew
[Bug 210911] error: implicit declaration of function 'cleanup_cpu_mmu_context' [-Werror=implicit-function-declaration]
https://bugzilla.kernel.org/show_bug.cgi?id=210911 Michael Ellerman (mich...@ellerman.id.au) changed: What|Removed |Added Status|RESOLVED|CLOSED -- You may reply to this email to add a comment. You are receiving this mail because: You are watching the assignee of the bug.
[Bug 210911] error: implicit declaration of function 'cleanup_cpu_mmu_context' [-Werror=implicit-function-declaration]
https://bugzilla.kernel.org/show_bug.cgi?id=210911 Michael Ellerman (mich...@ellerman.id.au) changed: What|Removed |Added Status|NEW |RESOLVED CC||mich...@ellerman.id.au Resolution|--- |CODE_FIX --- Comment #1 from Michael Ellerman (mich...@ellerman.id.au) --- Fixed in c1bea0a840ac ("powerpc/32s: Fix cleanup_cpu_mmu_context() compile bug") -- You may reply to this email to add a comment. You are receiving this mail because: You are watching the assignee of the bug.
[PATCH] net: ethernet: fs_enet: Add missing MODULE_LICENSE
Since commit 1d6cd3929360 ("modpost: turn missing MODULE_LICENSE() into error") the ppc32_allmodconfig build fails with: ERROR: modpost: missing MODULE_LICENSE() in drivers/net/ethernet/freescale/fs_enet/mii-fec.o ERROR: modpost: missing MODULE_LICENSE() in drivers/net/ethernet/freescale/fs_enet/mii-bitbang.o Add the missing MODULE_LICENSEs to fix the build. Both files include a copyright header indicating they are GPL v2. Signed-off-by: Michael Ellerman --- drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c | 1 + drivers/net/ethernet/freescale/fs_enet/mii-fec.c | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c b/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c index c8e5d889bd81..76ac1a9eab58 100644 --- a/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c +++ b/drivers/net/ethernet/freescale/fs_enet/mii-bitbang.c @@ -223,3 +223,4 @@ static struct platform_driver fs_enet_bb_mdio_driver = { }; module_platform_driver(fs_enet_bb_mdio_driver); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/net/ethernet/freescale/fs_enet/mii-fec.c b/drivers/net/ethernet/freescale/fs_enet/mii-fec.c index 8b51ee142fa3..407c330b432f 100644 --- a/drivers/net/ethernet/freescale/fs_enet/mii-fec.c +++ b/drivers/net/ethernet/freescale/fs_enet/mii-fec.c @@ -224,3 +224,4 @@ static struct platform_driver fs_enet_fec_mdio_driver = { }; module_platform_driver(fs_enet_fec_mdio_driver); +MODULE_LICENSE("GPL v2"); -- 2.25.1
Re: [PATCH] scsi: target/sbp: remove firewire SBP target driver
On 1/4/21 2:50 PM, Finn Thain wrote: > On Mon, 4 Jan 2021, Bart Van Assche wrote: >> Additionally, there is a good alternative available for the sbp driver. >> Every system I know of that is equipped with a Firewire port also has an >> Ethernet port. So users who want to provide SCSI target functionality on >> such systems can use any SCSI transport protocol that is compatible with >> Ethernet (iSCSI, iSER over soft-RoCE, SRP over soft-RoCE, ...). > > Ethernet is not always an alternative. That was already discussed in this > thread. But let's assume for a moment that you can migrate any and all > users of this driver over to an ethernet driver. > > Why would the maintainers of that Ethernet driver and its API accept that > plan, if adding users would extend their maintenance and testing > obligations? Do you think those maintainers should pay the "kind of tax > that all developers/users pay to all developers/users?" Hi Finn, I cannot speak in the name of the iSCSI over TCP/IP or iSER driver maintainers. But since I maintain the SRP initiator and target kernel drivers myself, I can state that I would be happy to help SBP target users (if that driver has any users today) to switch from SCSI over Firewire to SCSI over SRP over RoCE or even NVMEoF over TCP. Thanks, Bart.
[PATCH AUTOSEL 5.10 13/17] local64.h: make mandatory
From: Randy Dunlap [ Upstream commit 87dbc209ea04645fd2351981f09eff5d23f8e2e9 ] Make mandatory in include/asm-generic/Kbuild and remove all arch/*/include/asm/local64.h arch-specific files since they only #include . This fixes build errors on arch/c6x/ and arch/nios2/ for block/blk-iocost.c. Build-tested on 21 of 25 arch-es. (tools problems on the others) Yes, we could even rename to and change all #includes to use instead. Link: https://lkml.kernel.org/r/20201227024446.17018-1-rdun...@infradead.org Signed-off-by: Randy Dunlap Suggested-by: Christoph Hellwig Reviewed-by: Masahiro Yamada Cc: Jens Axboe Cc: Ley Foon Tan Cc: Mark Salter Cc: Aurelien Jacquiot Cc: Peter Zijlstra Cc: Arnd Bergmann Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- arch/alpha/include/asm/local64.h | 1 - arch/arc/include/asm/Kbuild| 1 - arch/arm/include/asm/Kbuild| 1 - arch/arm64/include/asm/Kbuild | 1 - arch/csky/include/asm/Kbuild | 1 - arch/h8300/include/asm/Kbuild | 1 - arch/hexagon/include/asm/Kbuild| 1 - arch/ia64/include/asm/local64.h| 1 - arch/m68k/include/asm/Kbuild | 1 - arch/microblaze/include/asm/Kbuild | 1 - arch/mips/include/asm/Kbuild | 1 - arch/nds32/include/asm/Kbuild | 1 - arch/parisc/include/asm/Kbuild | 1 - arch/powerpc/include/asm/Kbuild| 1 - arch/riscv/include/asm/Kbuild | 1 - arch/s390/include/asm/Kbuild | 1 - arch/sh/include/asm/Kbuild | 1 - arch/sparc/include/asm/Kbuild | 1 - arch/x86/include/asm/local64.h | 1 - arch/xtensa/include/asm/Kbuild | 1 - include/asm-generic/Kbuild | 1 + 21 files changed, 1 insertion(+), 20 deletions(-) delete mode 100644 arch/alpha/include/asm/local64.h delete mode 100644 arch/ia64/include/asm/local64.h delete mode 100644 arch/x86/include/asm/local64.h diff --git a/arch/alpha/include/asm/local64.h b/arch/alpha/include/asm/local64.h deleted file mode 100644 index 36c93b5cc239b..0 --- a/arch/alpha/include/asm/local64.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/arc/include/asm/Kbuild b/arch/arc/include/asm/Kbuild index 81f4edec0c2a9..3c1afa524b9c2 100644 --- a/arch/arc/include/asm/Kbuild +++ b/arch/arc/include/asm/Kbuild @@ -1,7 +1,6 @@ # SPDX-License-Identifier: GPL-2.0 generic-y += extable.h generic-y += kvm_para.h -generic-y += local64.h generic-y += mcs_spinlock.h generic-y += parport.h generic-y += user.h diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild index 383635b68763c..f1398b9267c08 100644 --- a/arch/arm/include/asm/Kbuild +++ b/arch/arm/include/asm/Kbuild @@ -2,7 +2,6 @@ generic-y += early_ioremap.h generic-y += extable.h generic-y += flat.h -generic-y += local64.h generic-y += parport.h generic-y += seccomp.h diff --git a/arch/arm64/include/asm/Kbuild b/arch/arm64/include/asm/Kbuild index ff9cbb6312128..07ac208edc894 100644 --- a/arch/arm64/include/asm/Kbuild +++ b/arch/arm64/include/asm/Kbuild @@ -1,6 +1,5 @@ # SPDX-License-Identifier: GPL-2.0 generic-y += early_ioremap.h -generic-y += local64.h generic-y += mcs_spinlock.h generic-y += qrwlock.h generic-y += qspinlock.h diff --git a/arch/csky/include/asm/Kbuild b/arch/csky/include/asm/Kbuild index 64876e59e2ef9..2a5a4d94fafad 100644 --- a/arch/csky/include/asm/Kbuild +++ b/arch/csky/include/asm/Kbuild @@ -2,7 +2,6 @@ generic-y += asm-offsets.h generic-y += gpio.h generic-y += kvm_para.h -generic-y += local64.h generic-y += qrwlock.h generic-y += seccomp.h generic-y += user.h diff --git a/arch/h8300/include/asm/Kbuild b/arch/h8300/include/asm/Kbuild index ddf04f32b5467..60ee7f0d60a8f 100644 --- a/arch/h8300/include/asm/Kbuild +++ b/arch/h8300/include/asm/Kbuild @@ -2,7 +2,6 @@ generic-y += asm-offsets.h generic-y += extable.h generic-y += kvm_para.h -generic-y += local64.h generic-y += mcs_spinlock.h generic-y += parport.h generic-y += spinlock.h diff --git a/arch/hexagon/include/asm/Kbuild b/arch/hexagon/include/asm/Kbuild index 373964bb177e4..3ece3c93fe086 100644 --- a/arch/hexagon/include/asm/Kbuild +++ b/arch/hexagon/include/asm/Kbuild @@ -2,5 +2,4 @@ generic-y += extable.h generic-y += iomap.h generic-y += kvm_para.h -generic-y += local64.h generic-y += mcs_spinlock.h diff --git a/arch/ia64/include/asm/local64.h b/arch/ia64/include/asm/local64.h deleted file mode 100644 index 36c93b5cc239b..0 --- a/arch/ia64/include/asm/local64.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/arch/m68k/include/asm/Kbuild b/arch/m68k/include/asm/Kbuild index 1bff55aa2d54e..0dbf9c5c6faeb 100644 --- a/arch/m68k/include/asm/Kbuild +++ b/arch/m68k/include/asm/Kbuild @@ -2,6 +2,5 @@ generated-y += syscall_table.h generic-y += extable.h generic-y += kvm_para.h -generic-y += local64.h generic-y += mcs_spinlock.h generic-y += spinlock.h diff --git a/arch/microblaze/include/asm/Kbuild b/arch/microblaze/include/asm/Kbuild index 63bce836b9f10..29b
Re: [PATCH] scsi: target/sbp: remove firewire SBP target driver
On Mon, 4 Jan 2021, Bart Van Assche wrote: > On 6/16/20 7:07 PM, Finn Thain wrote: > > On Tue, 16 Jun 2020, Bart Van Assche wrote: > >> As far as I know the sbp driver only has had one user ever and that > >> user is no longer user the sbp driver. > > > > So, you estimate the userbase at zero. Can you give a confidence > > level? Actual measurement is hard because when end users encounter > > breakage, they look for quick workarounds before they undertake post > > mortem, log collection, bug reporting, mailing list discussions, > > analysis etc. > > (replying to an e-mail from six months ago) > > Hi Finn, > > I am confident that my estimate is an accurate estimate since I have not > seen any sbp support requests, sbp bug reports nor any sbp bug fixes > since the sbp target driver has been accepted upstream. > That suggests to me that the code that you're hoping to remove 1) has no bugs, or 2) has no reported bugs, or 3) has no users at present. I am confident that your evidence does not support your conclusion (i.e. the code will never be used again). Sometimes, users only appear after the unreported bugs get fixed. I've seen it happen. > > Here's a different question: "Why remove it from the kernel tree?" > > > > If maintaining this code is a burden, is it not the kind of tax that > > all developers/users pay to all developers/users? Does this driver > > impose an unreasonably high burden for some reason? > > Yes. If anyone wants to change the interface between SCSI target core > and SCSI target drivers, all target drivers, including the sbp and FCoE > target driver have to be retested. I'm unaware of such an obligation. API changes happen often. When they do, we see good test coverage of commercially viable hardware, some best-effort testing of common hardware, and some perfunctory build testing. But that is missing the point, which was about a particular driver, not about development process. You have not shown how the target API is special, to support your claim that this driver imposes an unreasonable burden. In the interests of making forward progress in this discussion, shall we discuss the kind of SCSI Target API changes that you anticipate? > In other words, keeping unused target drivers inside the kernel tree > involves a significant maintenance burden for anyone who wants to modify > the interface between the SCSI target core and SCSI target drivers. > Keeping _any_ driver in the kernel involves a maintenance burden. There are two good ways to address that. Firstly, by improving the development process. For example, an API change is mostly mechanical work that lends itself to automated refactoring. Secondly, by involving all interested parties, so that the burden is shared. Of course, there are other ways. E.g. "don't ship code when doing so won't turn a profit". That, by the way, was the policy that gave us 10 billion Android devices (or more) that don't function with a mainline kernel. > Additionally, there is a good alternative available for the sbp driver. > Every system I know of that is equipped with a Firewire port also has an > Ethernet port. So users who want to provide SCSI target functionality on > such systems can use any SCSI transport protocol that is compatible with > Ethernet (iSCSI, iSER over soft-RoCE, SRP over soft-RoCE, ...). > Ethernet is not always an alternative. That was already discussed in this thread. But let's assume for a moment that you can migrate any and all users of this driver over to an ethernet driver. Why would the maintainers of that ethernet driver and its API accept that plan, if adding users would extend their maintenance and testing obligations? Do you think those maintainers should pay the "kind of tax that all developers/users pay to all developers/users?" > Thanks, > > Bart. >
[PATCH v2 4/5] ibmvfc: complete commands outside the host/queue lock
Drain the command queue and place all commands on a completion list. Perform command completion on that list outside the host/queue locks. Further, move purged command compeletions outside the host_lock as well. Signed-off-by: Tyrel Datwyler Reviewed-by: Brian King --- Changes in v2: * Changed ibmvfc_locked_done to static fixing no-prototype warning drivers/scsi/ibmvscsi/ibmvfc.c | 58 ++ drivers/scsi/ibmvscsi/ibmvfc.h | 3 +- 2 files changed, 47 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index 69a6401ca504..f680f96d5d06 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c @@ -894,7 +894,7 @@ static void ibmvfc_scsi_eh_done(struct ibmvfc_event *evt) * @purge_list:list head of failed commands * * This function runs completions on commands to fail as a result of a - * host reset or platform migration. Caller must hold host_lock. + * host reset or platform migration. **/ static void ibmvfc_complete_purge(struct list_head *purge_list) { @@ -1407,6 +1407,23 @@ static struct ibmvfc_event *ibmvfc_get_event(struct ibmvfc_queue *queue) return evt; } +/** + * ibmvfc_locked_done - Calls evt completion with host_lock held + * @evt: ibmvfc evt to complete + * + * All non-scsi command completion callbacks have the expectation that the + * host_lock is held. This callback is used by ibmvfc_init_event to wrap a + * MAD evt with the host_lock. + **/ +static void ibmvfc_locked_done(struct ibmvfc_event *evt) +{ + unsigned long flags; + + spin_lock_irqsave(evt->vhost->host->host_lock, flags); + evt->_done(evt); + spin_unlock_irqrestore(evt->vhost->host->host_lock, flags); +} + /** * ibmvfc_init_event - Initialize fields in an event struct that are always * required. @@ -1419,9 +1436,14 @@ static void ibmvfc_init_event(struct ibmvfc_event *evt, { evt->cmnd = NULL; evt->sync_iu = NULL; - evt->crq.format = format; - evt->done = done; evt->eh_comp = NULL; + evt->crq.format = format; + if (format == IBMVFC_CMD_FORMAT) + evt->done = done; + else { + evt->_done = done; + evt->done = ibmvfc_locked_done; + } } /** @@ -1640,7 +1662,9 @@ static void ibmvfc_relogin(struct scsi_device *sdev) struct ibmvfc_host *vhost = shost_priv(sdev->host); struct fc_rport *rport = starget_to_rport(scsi_target(sdev)); struct ibmvfc_target *tgt; + unsigned long flags; + spin_lock_irqsave(vhost->host->host_lock, flags); list_for_each_entry(tgt, &vhost->targets, queue) { if (rport == tgt->rport) { ibmvfc_del_tgt(tgt); @@ -1649,6 +1673,7 @@ static void ibmvfc_relogin(struct scsi_device *sdev) } ibmvfc_reinit_host(vhost); + spin_unlock_irqrestore(vhost->host->host_lock, flags); } /** @@ -2901,7 +2926,8 @@ static void ibmvfc_handle_async(struct ibmvfc_async_crq *crq, * @vhost: ibmvfc host struct * **/ -static void ibmvfc_handle_crq(struct ibmvfc_crq *crq, struct ibmvfc_host *vhost) +static void ibmvfc_handle_crq(struct ibmvfc_crq *crq, struct ibmvfc_host *vhost, + struct list_head *evt_doneq) { long rc; struct ibmvfc_event *evt = (struct ibmvfc_event *)be64_to_cpu(crq->ioba); @@ -2972,12 +2998,9 @@ static void ibmvfc_handle_crq(struct ibmvfc_crq *crq, struct ibmvfc_host *vhost) return; } - del_timer(&evt->timer); spin_lock(&evt->queue->l_lock); - list_del(&evt->queue_list); + list_move_tail(&evt->queue_list, evt_doneq); spin_unlock(&evt->queue->l_lock); - ibmvfc_trc_end(evt); - evt->done(evt); } /** @@ -3364,8 +3387,10 @@ static void ibmvfc_tasklet(void *data) struct vio_dev *vdev = to_vio_dev(vhost->dev); struct ibmvfc_crq *crq; struct ibmvfc_async_crq *async; + struct ibmvfc_event *evt, *temp; unsigned long flags; int done = 0; + LIST_HEAD(evt_doneq); spin_lock_irqsave(vhost->host->host_lock, flags); spin_lock(vhost->crq.q_lock); @@ -3379,7 +3404,7 @@ static void ibmvfc_tasklet(void *data) /* Pull all the valid messages off the CRQ */ while ((crq = ibmvfc_next_crq(vhost)) != NULL) { - ibmvfc_handle_crq(crq, vhost); + ibmvfc_handle_crq(crq, vhost, &evt_doneq); crq->valid = 0; wmb(); } @@ -3392,7 +3417,7 @@ static void ibmvfc_tasklet(void *data) wmb(); } else if ((crq = ibmvfc_next_crq(vhost)) != NULL) { vio_disable_interrupts(vdev); - ibmvfc_handle_crq(crq, vhost); +
Re: [PATCH 4/5 v2] ibmvfc: relax locking around ibmvfc_queuecommand
On 1/4/21 2:17 PM, Tyrel Datwyler wrote: > The drivers queuecommand routine is still wrapped to hold the host lock > for the duration of the call. This will become problematic when moving > to multiple queues due to the lock contention preventing asynchronous > submissions to mulitple queues. There is no real legatimate reason to > hold the host lock, and previous patches have insured proper protection > of moving ibmvfc_event objects between free and sent lists. > > Signed-off-by: Tyrel Datwyler > Reviewed-by: Brian King > --- Ignore. This is the wrong updated patch. -Tyrel
[PATCH 4/5 v2] ibmvfc: relax locking around ibmvfc_queuecommand
The drivers queuecommand routine is still wrapped to hold the host lock for the duration of the call. This will become problematic when moving to multiple queues due to the lock contention preventing asynchronous submissions to mulitple queues. There is no real legatimate reason to hold the host lock, and previous patches have insured proper protection of moving ibmvfc_event objects between free and sent lists. Signed-off-by: Tyrel Datwyler Reviewed-by: Brian King --- drivers/scsi/ibmvscsi/ibmvfc.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/ibmvscsi/ibmvfc.c b/drivers/scsi/ibmvscsi/ibmvfc.c index f680f96d5d06..ff86c43b4b33 100644 --- a/drivers/scsi/ibmvscsi/ibmvfc.c +++ b/drivers/scsi/ibmvscsi/ibmvfc.c @@ -1793,10 +1793,9 @@ static struct ibmvfc_cmd *ibmvfc_init_vfc_cmd(struct ibmvfc_event *evt, struct s * Returns: * 0 on success / other on failure **/ -static int ibmvfc_queuecommand_lck(struct scsi_cmnd *cmnd, - void (*done) (struct scsi_cmnd *)) +static int ibmvfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd) { - struct ibmvfc_host *vhost = shost_priv(cmnd->device->host); + struct ibmvfc_host *vhost = shost_priv(shost); struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device)); struct ibmvfc_cmd *vfc_cmd; struct ibmvfc_fcp_cmd_iu *iu; @@ -1806,7 +1805,7 @@ static int ibmvfc_queuecommand_lck(struct scsi_cmnd *cmnd, if (unlikely((rc = fc_remote_port_chkready(rport))) || unlikely((rc = ibmvfc_host_chkready(vhost { cmnd->result = rc; - done(cmnd); + cmnd->scsi_done(cmnd); return 0; } @@ -1814,7 +1813,6 @@ static int ibmvfc_queuecommand_lck(struct scsi_cmnd *cmnd, evt = ibmvfc_get_event(&vhost->crq); ibmvfc_init_event(evt, ibmvfc_scsi_done, IBMVFC_CMD_FORMAT); evt->cmnd = cmnd; - cmnd->scsi_done = done; vfc_cmd = ibmvfc_init_vfc_cmd(evt, cmnd->device); iu = ibmvfc_get_fcp_iu(vhost, vfc_cmd); @@ -1841,12 +1839,10 @@ static int ibmvfc_queuecommand_lck(struct scsi_cmnd *cmnd, "Failed to map DMA buffer for command. rc=%d\n", rc); cmnd->result = DID_ERROR << 16; - done(cmnd); + cmnd->scsi_done(cmnd); return 0; } -static DEF_SCSI_QCMD(ibmvfc_queuecommand) - /** * ibmvfc_sync_completion - Signal that a synchronous command has completed * @evt: ibmvfc event struct -- 2.27.0
Re: [PATCH] ibmvnic: fix: NULL pointer dereference.
Hello: This patch was applied to netdev/net.git (refs/heads/master): On Wed, 30 Dec 2020 15:23:14 +0800 you wrote: > The error is due to dereference a null pointer in function > reset_one_sub_crq_queue(): > > if (!scrq) { > netdev_dbg(adapter->netdev, >"Invalid scrq reset. irq (%d) or msgs(%p).\n", > scrq->irq, scrq->msgs); > return -EINVAL; > } > > [...] Here is the summary with links: - ibmvnic: fix: NULL pointer dereference. https://git.kernel.org/netdev/net/c/862aecbd9569 You are awesome, thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html
[PATCH v2] powerpc: Handle .text.{hot,unlikely}.* in linker script
Commit eff8728fe698 ("vmlinux.lds.h: Add PGO and AutoFDO input sections") added ".text.unlikely.*" and ".text.hot.*" due to an LLVM change [1]. After another LLVM change [2], these sections are seen in some PowerPC builds, where there is a orphan section warning then build failure: $ make -skj"$(nproc)" \ ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- LLVM=1 O=out \ distclean powernv_defconfig zImage.epapr ld.lld: warning: kernel/built-in.a(panic.o):(.text.unlikely.) is being placed in '.text.unlikely.' ... ld.lld: warning: address (0xc0009314) of section .text is not a multiple of alignment (256) ... ERROR: start_text address is c0009400, should be c0008000 ERROR: try to enable LD_HEAD_STUB_CATCH config option ERROR: see comments in arch/powerpc/tools/head_check.sh ... Explicitly handle these sections like in the main linker script so there is no more build failure. [1]: https://reviews.llvm.org/D79600 [2]: https://reviews.llvm.org/D92493 Cc: sta...@vger.kernel.org Fixes: 83a092cf95f2 ("powerpc: Link warning for orphan sections") Link: https://github.com/ClangBuiltLinux/linux/issues/1218 Signed-off-by: Nathan Chancellor --- v1 -> v2: * Add missing [1] and [2] references in commit message. Thanks to Sedat Dilek for pointing it out! arch/powerpc/kernel/vmlinux.lds.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index 0318ba436f34..8e0b1298bf19 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S @@ -85,7 +85,7 @@ SECTIONS ALIGN_FUNCTION(); #endif /* careful! __ftr_alt_* sections need to be close to .text */ - *(.text.hot TEXT_MAIN .text.fixup .text.unlikely .fixup __ftr_alt_* .ref.text); + *(.text.hot .text.hot.* TEXT_MAIN .text.fixup .text.unlikely .text.unlikely.* .fixup __ftr_alt_* .ref.text); #ifdef CONFIG_PPC64 *(.tramp.ftrace.text); #endif base-commit: d8a4f20584d5906093a8fc6aa06622102a501095 -- 2.30.0
Re: [PATCH] powerpc: Handle .text.{hot,unlikely}.* in linker script
On Mon, Jan 04, 2021 at 09:55:20PM +0100, Sedat Dilek wrote: > On Mon, Jan 4, 2021 at 9:49 PM Nathan Chancellor > wrote: > > > > Commit eff8728fe698 ("vmlinux.lds.h: Add PGO and AutoFDO input > > sections") added ".text.unlikely.*" and ".text.hot.*" due to an LLVM > > change [1]. > > > > After another LLVM change [2], these sections are seen in some PowerPC > > builds, where there is a orphan section warning then build failure: > > > > Looks like you forgot to add your references/links to [1] and [2]. Indeed, thank you for pointing that out! v2 coming shortly. > Might be good to mention...? > > With CONFIG_LD_ORPHAN_WARN=y is enabled Since this symbol is not user selectable, I do not really think it is worth mentioning, plus PowerPC has had this enabled for a while :) Cheers, Nathan
Re: [PATCH] powerpc: Handle .text.{hot,unlikely}.* in linker script
On Mon, Jan 4, 2021 at 9:49 PM Nathan Chancellor wrote: > > Commit eff8728fe698 ("vmlinux.lds.h: Add PGO and AutoFDO input > sections") added ".text.unlikely.*" and ".text.hot.*" due to an LLVM > change [1]. > > After another LLVM change [2], these sections are seen in some PowerPC > builds, where there is a orphan section warning then build failure: > Looks like you forgot to add your references/links to [1] and [2]. Might be good to mention...? With CONFIG_LD_ORPHAN_WARN=y is enabled - Sedat > $ make -skj"$(nproc)" \ >ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- LLVM=1 O=out \ >distclean powernv_defconfig zImage.epapr > ld.lld: warning: kernel/built-in.a(panic.o):(.text.unlikely.) is being placed > in '.text.unlikely.' > ... > ld.lld: warning: address (0xc0009314) of section .text is not a > multiple of alignment (256) > ... > ERROR: start_text address is c0009400, should be c0008000 > ERROR: try to enable LD_HEAD_STUB_CATCH config option > ERROR: see comments in arch/powerpc/tools/head_check.sh > ... > > Explicitly handle these sections like in the main linker script so > there is no more build failure. > > Cc: sta...@vger.kernel.org > Fixes: 83a092cf95f2 ("powerpc: Link warning for orphan sections") > Link: https://github.com/ClangBuiltLinux/linux/issues/1218 > Signed-off-by: Nathan Chancellor > --- > arch/powerpc/kernel/vmlinux.lds.S | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/powerpc/kernel/vmlinux.lds.S > b/arch/powerpc/kernel/vmlinux.lds.S > index 0318ba436f34..8e0b1298bf19 100644 > --- a/arch/powerpc/kernel/vmlinux.lds.S > +++ b/arch/powerpc/kernel/vmlinux.lds.S > @@ -85,7 +85,7 @@ SECTIONS > ALIGN_FUNCTION(); > #endif > /* careful! __ftr_alt_* sections need to be close to .text */ > - *(.text.hot TEXT_MAIN .text.fixup .text.unlikely .fixup > __ftr_alt_* .ref.text); > + *(.text.hot .text.hot.* TEXT_MAIN .text.fixup .text.unlikely > .text.unlikely.* .fixup __ftr_alt_* .ref.text); > #ifdef CONFIG_PPC64 > *(.tramp.ftrace.text); > #endif > > base-commit: d8a4f20584d5906093a8fc6aa06622102a501095 > -- > 2.30.0 > > -- > You received this message because you are subscribed to the Google Groups > "Clang Built Linux" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to clang-built-linux+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/clang-built-linux/20210104204850.990966-1-natechancellor%40gmail.com.
[PATCH] powerpc: Handle .text.{hot,unlikely}.* in linker script
Commit eff8728fe698 ("vmlinux.lds.h: Add PGO and AutoFDO input sections") added ".text.unlikely.*" and ".text.hot.*" due to an LLVM change [1]. After another LLVM change [2], these sections are seen in some PowerPC builds, where there is a orphan section warning then build failure: $ make -skj"$(nproc)" \ ARCH=powerpc CROSS_COMPILE=powerpc64le-linux-gnu- LLVM=1 O=out \ distclean powernv_defconfig zImage.epapr ld.lld: warning: kernel/built-in.a(panic.o):(.text.unlikely.) is being placed in '.text.unlikely.' ... ld.lld: warning: address (0xc0009314) of section .text is not a multiple of alignment (256) ... ERROR: start_text address is c0009400, should be c0008000 ERROR: try to enable LD_HEAD_STUB_CATCH config option ERROR: see comments in arch/powerpc/tools/head_check.sh ... Explicitly handle these sections like in the main linker script so there is no more build failure. Cc: sta...@vger.kernel.org Fixes: 83a092cf95f2 ("powerpc: Link warning for orphan sections") Link: https://github.com/ClangBuiltLinux/linux/issues/1218 Signed-off-by: Nathan Chancellor --- arch/powerpc/kernel/vmlinux.lds.S | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/vmlinux.lds.S b/arch/powerpc/kernel/vmlinux.lds.S index 0318ba436f34..8e0b1298bf19 100644 --- a/arch/powerpc/kernel/vmlinux.lds.S +++ b/arch/powerpc/kernel/vmlinux.lds.S @@ -85,7 +85,7 @@ SECTIONS ALIGN_FUNCTION(); #endif /* careful! __ftr_alt_* sections need to be close to .text */ - *(.text.hot TEXT_MAIN .text.fixup .text.unlikely .fixup __ftr_alt_* .ref.text); + *(.text.hot .text.hot.* TEXT_MAIN .text.fixup .text.unlikely .text.unlikely.* .fixup __ftr_alt_* .ref.text); #ifdef CONFIG_PPC64 *(.tramp.ftrace.text); #endif base-commit: d8a4f20584d5906093a8fc6aa06622102a501095 -- 2.30.0
Re: [GIT PULL] Fix kprobes issue by moving RCU-tasks initialization earlier
The pull request you sent on Mon, 4 Jan 2021 10:19:34 -0800: > git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git rcu/urgent has been merged into torvalds/linux.git: https://git.kernel.org/torvalds/c/36bbbd0e234d817938bdc52121a0f5473b3e58f5 Thank you! -- Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/prtracker.html
[GIT PULL] Fix kprobes issue by moving RCU-tasks initialization earlier
Hello, Linus, This fix is for a regression in the v5.10 merge window, but it was reported quite late in the v5.10 process, plus generating and testing the fix took some time. The regression is due to 36dadef23fcc ("kprobes: Init kprobes in early_initcall") which on powerpc can use RCU Tasks before initialization, resulting in boot failures. The fix is straightforward, simply moving initialization of RCU Tasks before the early_initcall()s. The fix has been exposed to -next and kbuild test robot testing, and has been tested by the PowerPC guys. The following changes since commit 0477e92881850d44910a7e94fc2c46f96faa131f: Linux 5.10-rc7 (2020-12-06 14:25:12 -0800) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-rcu.git rcu/urgent for you to fetch changes up to 1b04fa9900263b4e217ca2509fd778b32c2b4eb2: rcu-tasks: Move RCU-tasks initialization to before early_initcall() (2020-12-14 15:31:13 -0800) Uladzislau Rezki (Sony) (1): rcu-tasks: Move RCU-tasks initialization to before early_initcall() include/linux/rcupdate.h | 6 ++ init/main.c | 1 + kernel/rcu/tasks.h | 25 + 3 files changed, 28 insertions(+), 4 deletions(-)
Re: [PATCH] scsi: target/sbp: remove firewire SBP target driver
On 6/16/20 7:07 PM, Finn Thain wrote: > On Tue, 16 Jun 2020, Bart Van Assche wrote: >> As far as I know the sbp driver only has had one user ever and that user >> is no longer user the sbp driver. > > So, you estimate the userbase at zero. Can you give a confidence level? > Actual measurement is hard because when end users encounter breakage, they > look for quick workarounds before they undertake post mortem, log > collection, bug reporting, mailing list discussions, analysis etc. (replying to an e-mail from six months ago) Hi Finn, I am confident that my estimate is an accurate estimate since I have not seen any sbp support requests, sbp bug reports nor any sbp bug fixes since the sbp target driver has been accepted upstream. > Here's a different question: "Why remove it from the kernel tree?" > > If maintaining this code is a burden, is it not the kind of tax that all > developers/users pay to all developers/users? Does this driver impose an > unreasonably high burden for some reason? Yes. If anyone wants to change the interface between SCSI target core and SCSI target drivers, all target drivers, including the sbp and FCoE target driver have to be retested. In other words, keeping unused target drivers inside the kernel tree involves a significant maintenance burden for anyone who wants to modify the interface between the SCSI target core and SCSI target drivers. Additionally, there is a good alternative available for the sbp driver. Every system I know of that is equipped with a Firewire port also has an Ethernet port. So users who want to provide SCSI target functionality on such systems can use any SCSI transport protocol that is compatible with Ethernet (iSCSI, iSER over soft-RoCE, SRP over soft-RoCE, ...). Thanks, Bart.
[PATCH v2 05/23] powerpc/pmem: Include pmem prototypes
It fixes this W=1 compile error : ../arch/powerpc/lib/pmem.c:51:6: error: no previous prototype for ‘arch_wb_cache_pmem’ [-Werror=missing-prototypes] 51 | void arch_wb_cache_pmem(void *addr, size_t size) | ^~ ../arch/powerpc/lib/pmem.c:58:6: error: no previous prototype for ‘arch_invalidate_pmem’ [-Werror=missing-prototypes] 58 | void arch_invalidate_pmem(void *addr, size_t size) | ^~~~ Fixes: 32ce3862af3c ("powerpc/lib: Implement PMEM API") Signed-off-by: Cédric Le Goater --- arch/powerpc/lib/pmem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/lib/pmem.c b/arch/powerpc/lib/pmem.c index 1550e0d2513a..eb2919ddf9b9 100644 --- a/arch/powerpc/lib/pmem.c +++ b/arch/powerpc/lib/pmem.c @@ -6,6 +6,7 @@ #include #include #include +#include #include -- 2.26.2
[PATCH v2 01/23] powerpc/mm: Include __find_linux_pte() prototype
It fixes this W=1 compile error : ../arch/powerpc/mm/pgtable.c:337:8: error: no previous prototype for ‘__find_linux_pte’ [-Werror=missing-prototypes] 337 | pte_t *__find_linux_pte(pgd_t *pgdir, unsigned long ea, |^~~~ Cc: "Aneesh Kumar K.V" Signed-off-by: Cédric Le Goater --- arch/powerpc/mm/pgtable.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c index 1c95cebc..3a41545e5c07 100644 --- a/arch/powerpc/mm/pgtable.c +++ b/arch/powerpc/mm/pgtable.c @@ -26,6 +26,7 @@ #include #include #include +#include static inline int is_exec_fault(void) { -- 2.26.2
[PATCH v2 06/23] powerpc/setup_64: Make some routines static
The following routines are only called by local services and do not need to be external symbols. It fixes these W=1 errors : ../arch/powerpc/kernel/setup_64.c:261:13: error: no previous prototype for ‘record_spr_defaults’ [-Werror=missing-prototypes] 261 | void __init record_spr_defaults(void) | ^~~ ../arch/powerpc/kernel/setup_64.c:1011:6: error: no previous prototype for ‘entry_flush_enable’ [-Werror=missing-prototypes] 1011 | void entry_flush_enable(bool enable) | ^~ ../arch/powerpc/kernel/setup_64.c:1023:6: error: no previous prototype for ‘uaccess_flush_enable’ [-Werror=missing-prototypes] 1023 | void uaccess_flush_enable(bool enable) | ^~~~ Signed-off-by: Cédric Le Goater --- arch/powerpc/kernel/setup_64.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c index c28e949cc222..560ed8b975e7 100644 --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c @@ -67,6 +67,7 @@ #include #include #include +#include #include "setup.h" @@ -258,7 +259,7 @@ static void cpu_ready_for_interrupts(void) unsigned long spr_default_dscr = 0; -void __init record_spr_defaults(void) +static void __init record_spr_defaults(void) { if (early_cpu_has_feature(CPU_FTR_DSCR)) spr_default_dscr = mfspr(SPRN_DSCR); @@ -1008,7 +1009,7 @@ void rfi_flush_enable(bool enable) rfi_flush = enable; } -void entry_flush_enable(bool enable) +static void entry_flush_enable(bool enable) { if (enable) { do_entry_flush_fixups(enabled_flush_types); @@ -1020,7 +1021,7 @@ void entry_flush_enable(bool enable) entry_flush = enable; } -void uaccess_flush_enable(bool enable) +static void uaccess_flush_enable(bool enable) { if (enable) { do_uaccess_flush_fixups(enabled_flush_types); -- 2.26.2
[PATCH v2 22/23] powerpc/pcidn: Make IOV setup routines static
These are only used locally. It fixes these W=1 compile errors : ../arch/powerpc/platforms/pseries/pci.c:58:5: error: no previous prototype for ‘pseries_send_map_pe’ [-Werror=missing-prototypes] 58 | int pseries_send_map_pe(struct pci_dev *pdev, | ^~~ ../arch/powerpc/platforms/pseries/pci.c:91:6: error: no previous prototype for ‘pseries_set_pe_num’ [-Werror=missing-prototypes] 91 | void pseries_set_pe_num(struct pci_dev *pdev, u16 vf_index, __be16 pe_num) | ^~ ../arch/powerpc/platforms/pseries/pci.c:105:5: error: no previous prototype for ‘pseries_associate_pes’ [-Werror=missing-prototypes] 105 | int pseries_associate_pes(struct pci_dev *pdev, u16 num_vfs) | ^ ../arch/powerpc/platforms/pseries/pci.c:149:5: error: no previous prototype for ‘pseries_pci_sriov_enable’ [-Werror=missing-prototypes] 149 | int pseries_pci_sriov_enable(struct pci_dev *pdev, u16 num_vfs) | ^~~~ ../arch/powerpc/platforms/pseries/pci.c:192:5: error: no previous prototype for ‘pseries_pcibios_sriov_enable’ [-Werror=missing-prototypes] 192 | int pseries_pcibios_sriov_enable(struct pci_dev *pdev, u16 num_vfs) | ^~~~ ../arch/powerpc/platforms/pseries/pci.c:199:5: error: no previous prototype for ‘pseries_pcibios_sriov_disable’ [-Werror=missing-prototypes] 199 | int pseries_pcibios_sriov_disable(struct pci_dev *pdev) | ^ Cc: Frédéric Barrat Signed-off-by: Cédric Le Goater --- arch/powerpc/platforms/pseries/pci.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/arch/powerpc/platforms/pseries/pci.c b/arch/powerpc/platforms/pseries/pci.c index 72a4d4167849..1bffbd1c9a94 100644 --- a/arch/powerpc/platforms/pseries/pci.c +++ b/arch/powerpc/platforms/pseries/pci.c @@ -55,9 +55,8 @@ struct pe_map_bar_entry { __be32 reserved; /* Reserved Space */ }; -int pseries_send_map_pe(struct pci_dev *pdev, - u16 num_vfs, - struct pe_map_bar_entry *vf_pe_array) +static int pseries_send_map_pe(struct pci_dev *pdev, u16 num_vfs, + struct pe_map_bar_entry *vf_pe_array) { struct pci_dn *pdn; int rc; @@ -88,7 +87,7 @@ int pseries_send_map_pe(struct pci_dev *pdev, return rc; } -void pseries_set_pe_num(struct pci_dev *pdev, u16 vf_index, __be16 pe_num) +static void pseries_set_pe_num(struct pci_dev *pdev, u16 vf_index, __be16 pe_num) { struct pci_dn *pdn; @@ -102,7 +101,7 @@ void pseries_set_pe_num(struct pci_dev *pdev, u16 vf_index, __be16 pe_num) pdn->pe_num_map[vf_index]); } -int pseries_associate_pes(struct pci_dev *pdev, u16 num_vfs) +static int pseries_associate_pes(struct pci_dev *pdev, u16 num_vfs) { struct pci_dn *pdn; int i, rc, vf_index; @@ -146,7 +145,7 @@ int pseries_associate_pes(struct pci_dev *pdev, u16 num_vfs) return rc; } -int pseries_pci_sriov_enable(struct pci_dev *pdev, u16 num_vfs) +static int pseries_pci_sriov_enable(struct pci_dev *pdev, u16 num_vfs) { struct pci_dn *pdn; intrc; @@ -189,14 +188,14 @@ int pseries_pci_sriov_enable(struct pci_dev *pdev, u16 num_vfs) return rc; } -int pseries_pcibios_sriov_enable(struct pci_dev *pdev, u16 num_vfs) +static int pseries_pcibios_sriov_enable(struct pci_dev *pdev, u16 num_vfs) { /* Allocate PCI data */ add_sriov_vf_pdns(pdev); return pseries_pci_sriov_enable(pdev, num_vfs); } -int pseries_pcibios_sriov_disable(struct pci_dev *pdev) +static int pseries_pcibios_sriov_disable(struct pci_dev *pdev) { struct pci_dn *pdn; -- 2.26.2
[PATCH v2 20/23] KVM: PPC: Book3S HV: Declare some prototypes
This fixes these W=1 compile errors: ../arch/powerpc/kvm/book3s_hv_builtin.c:425:6: error: no previous prototype for ‘kvmppc_read_intr’ [-Werror=missing-prototypes] 425 | long kvmppc_read_intr(void) | ^~~~ ../arch/powerpc/kvm/book3s_hv_builtin.c:652:6: error: no previous prototype for ‘kvmppc_bad_interrupt’ [-Werror=missing-prototypes] 652 | void kvmppc_bad_interrupt(struct pt_regs *regs) | ^~~~ ../arch/powerpc/kvm/book3s_hv_builtin.c:695:6: error: no previous prototype for ‘kvmhv_p9_set_lpcr’ [-Werror=missing-prototypes] 695 | void kvmhv_p9_set_lpcr(struct kvm_split_mode *sip) | ^ ../arch/powerpc/kvm/book3s_hv_builtin.c:740:6: error: no previous prototype for ‘kvmhv_p9_restore_lpcr’ [-Werror=missing-prototypes] 740 | void kvmhv_p9_restore_lpcr(struct kvm_split_mode *sip) | ^ ../arch/powerpc/kvm/book3s_hv_builtin.c:768:6: error: no previous prototype for ‘kvmppc_set_msr_hv’ [-Werror=missing-prototypes] 768 | void kvmppc_set_msr_hv(struct kvm_vcpu *vcpu, u64 msr) | ^ ../arch/powerpc/kvm/book3s_hv_builtin.c:817:6: error: no previous prototype for ‘kvmppc_inject_interrupt_hv’ [-Werror=missing-prototypes] 817 | void kvmppc_inject_interrupt_hv(struct kvm_vcpu *vcpu, int vec, u64 srr1_flags) Cc: Paul Mackerras Signed-off-by: Cédric Le Goater --- arch/powerpc/include/asm/kvm_book3s.h | 7 +++ 1 file changed, 7 insertions(+) diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h index d32ec9ae73bd..2f5f919f6cd3 100644 --- a/arch/powerpc/include/asm/kvm_book3s.h +++ b/arch/powerpc/include/asm/kvm_book3s.h @@ -277,6 +277,13 @@ extern int kvmppc_hcall_impl_hv_realmode(unsigned long cmd); extern void kvmppc_copy_to_svcpu(struct kvm_vcpu *vcpu); extern void kvmppc_copy_from_svcpu(struct kvm_vcpu *vcpu); +long kvmppc_read_intr(void); +void kvmppc_bad_interrupt(struct pt_regs *regs); +void kvmhv_p9_set_lpcr(struct kvm_split_mode *sip); +void kvmhv_p9_restore_lpcr(struct kvm_split_mode *sip); +void kvmppc_set_msr_hv(struct kvm_vcpu *vcpu, u64 msr); +void kvmppc_inject_interrupt_hv(struct kvm_vcpu *vcpu, int vec, u64 srr1_flags); + #ifdef CONFIG_PPC_TRANSACTIONAL_MEM void kvmppc_save_tm_pr(struct kvm_vcpu *vcpu); void kvmppc_restore_tm_pr(struct kvm_vcpu *vcpu); -- 2.26.2
[PATCH v2 00/23] powerpc: Fix W=1 compile errors
Hello, Here is an assorted collection of fixes for W=1. After this series, only a few errors are left, some missing declarations in arch/powerpc/kernel/sys_ppc32.c, panic_smp_self_stop() declaration and a few of these which I don't know how to fix : ./arch/powerpc/xmon/xmon.c: In function ‘xmon_print_symbol’: ./arch/powerpc/xmon/xmon.c:3656:14: error: variable ‘name’ might be clobbered by ‘longjmp’ or ‘vfork’ [-Werror=clobbered] 3656 | const char *name = NULL; | ^~~~ Cheers, C. Changes in v2 : - improved commit logs - reworked some changes to reduce the number of lines. - fixed misuse of asm/asm-prototypes.h for soft_nmi_interrupt() Cédric Le Goater (23): powerpc/mm: Include __find_linux_pte() prototype powerpc/pseries/ras: Remove unused variable 'status' powerpc/pseries/eeh: Make pseries_pcibios_bus_add_device() static powerpc/pseries/ras: Make init_ras_hotplug_IRQ() static powerpc/pmem: Include pmem prototypes powerpc/setup_64: Make some routines static powerpc/mce: Include prototypes powerpc/smp: Include tick_broadcast() prototype powerpc/smp: Make debugger_ipi_callback() static powerpc/optprobes: Remove unused routine patch_imm32_load_insns() powerpc/optprobes: Make patch_imm64_load_insns() static powerpc/mm: Declare some prototypes powerpc/mm: Move hpte_insert_repeating() prototype powerpc/mm: Declare preload_new_slb_context() prototype powerpc/mm/hugetlb: Make pseries_alloc_bootmem_huge_page() static powerpc/mm: Declare arch_report_meminfo() prototype. powerpc/watchdog: Declare soft_nmi_interrupt() prototype KVM: PPC: Make the VMX instruction emulation routines static KVM: PPC: Book3S HV: Include prototypes KVM: PPC: Book3S HV: Declare some prototypes powerpc/pseries: Make IOV setup routines static powerpc/pcidn: Make IOV setup routines static powerpc/pseries/eeh: Make pseries_send_allow_unfreeze() static arch/powerpc/include/asm/book3s/64/mmu-hash.h | 5 + arch/powerpc/include/asm/kvm_book3s.h | 7 +++ arch/powerpc/include/asm/nmi.h| 1 + arch/powerpc/include/asm/pgtable.h| 3 +++ arch/powerpc/kernel/mce.c | 1 + arch/powerpc/kernel/optprobes.c | 21 +-- arch/powerpc/kernel/setup_64.c| 7 --- arch/powerpc/kernel/smp.c | 3 ++- arch/powerpc/kernel/watchdog.c| 1 + arch/powerpc/kvm/book3s_64_mmu_hv.c | 1 + arch/powerpc/kvm/powerpc.c| 8 +++ arch/powerpc/lib/pmem.c | 1 + arch/powerpc/mm/book3s64/hash_hugetlbpage.c | 4 arch/powerpc/mm/hugetlbpage.c | 2 +- arch/powerpc/mm/pgtable.c | 1 + arch/powerpc/platforms/pseries/eeh_pseries.c | 5 ++--- arch/powerpc/platforms/pseries/pci.c | 15 +++-- arch/powerpc/platforms/pseries/ras.c | 15 + arch/powerpc/platforms/pseries/setup.c| 8 +++ 19 files changed, 51 insertions(+), 58 deletions(-) -- 2.26.2
[PATCH v2 21/23] powerpc/pseries: Make IOV setup routines static
These are only used locally. It fixes these W=1 compile errors : ../arch/powerpc/platforms/pseries/setup.c:610:17: error: no previous prototype for ‘pseries_get_iov_fw_value’ [-Werror=missing-prototypes] 610 | resource_size_t pseries_get_iov_fw_value(struct pci_dev *dev, int resno, | ^~~~ ../arch/powerpc/platforms/pseries/setup.c:646:6: error: no previous prototype for ‘of_pci_set_vf_bar_size’ [-Werror=missing-prototypes] 646 | void of_pci_set_vf_bar_size(struct pci_dev *dev, const int *indexes) | ^~ ../arch/powerpc/platforms/pseries/setup.c:668:6: error: no previous prototype for ‘of_pci_parse_iov_addrs’ [-Werror=missing-prototypes] 668 | void of_pci_parse_iov_addrs(struct pci_dev *dev, const int *indexes) | ^~ Cc: Frédéric Barrat Signed-off-by: Cédric Le Goater --- arch/powerpc/platforms/pseries/setup.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c index 090c13f6c881..0272aa4e74e3 100644 --- a/arch/powerpc/platforms/pseries/setup.c +++ b/arch/powerpc/platforms/pseries/setup.c @@ -607,8 +607,8 @@ enum get_iov_fw_value_index { WDW_SIZE = 3 /* Get Window Size */ }; -resource_size_t pseries_get_iov_fw_value(struct pci_dev *dev, int resno, -enum get_iov_fw_value_index value) +static resource_size_t pseries_get_iov_fw_value(struct pci_dev *dev, int resno, + enum get_iov_fw_value_index value) { const int *indexes; struct device_node *dn = pci_device_to_OF_node(dev); @@ -643,7 +643,7 @@ resource_size_t pseries_get_iov_fw_value(struct pci_dev *dev, int resno, return ret; } -void of_pci_set_vf_bar_size(struct pci_dev *dev, const int *indexes) +static void of_pci_set_vf_bar_size(struct pci_dev *dev, const int *indexes) { struct resource *res; resource_size_t base, size; @@ -665,7 +665,7 @@ void of_pci_set_vf_bar_size(struct pci_dev *dev, const int *indexes) } } -void of_pci_parse_iov_addrs(struct pci_dev *dev, const int *indexes) +static void of_pci_parse_iov_addrs(struct pci_dev *dev, const int *indexes) { struct resource *res, *root, *conflict; resource_size_t base, size; -- 2.26.2
[PATCH v2 17/23] powerpc/watchdog: Declare soft_nmi_interrupt() prototype
soft_nmi_interrupt() usage requires PPC_WATCHDOG to be configured. Check the CONFIG definition to declare the prototype. It fixes this W=1 compile error : ../arch/powerpc/kernel/watchdog.c:250:6: error: no previous prototype for ‘soft_nmi_interrupt’ [-Werror=missing-prototypes] 250 | void soft_nmi_interrupt(struct pt_regs *regs) | ^~ Cc: Nicholas Piggin Signed-off-by: Cédric Le Goater --- arch/powerpc/include/asm/nmi.h | 1 + arch/powerpc/kernel/watchdog.c | 1 + 2 files changed, 2 insertions(+) diff --git a/arch/powerpc/include/asm/nmi.h b/arch/powerpc/include/asm/nmi.h index 84b4cfe73edd..63eccea93796 100644 --- a/arch/powerpc/include/asm/nmi.h +++ b/arch/powerpc/include/asm/nmi.h @@ -4,6 +4,7 @@ #ifdef CONFIG_PPC_WATCHDOG extern void arch_touch_nmi_watchdog(void); +void soft_nmi_interrupt(struct pt_regs *regs); #else static inline void arch_touch_nmi_watchdog(void) {} #endif diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c index af3c15a1d41e..3ae13c2a10cf 100644 --- a/arch/powerpc/kernel/watchdog.c +++ b/arch/powerpc/kernel/watchdog.c @@ -27,6 +27,7 @@ #include #include +#include /* * The powerpc watchdog ensures that each CPU is able to service timers. -- 2.26.2
[PATCH v2 19/23] KVM: PPC: Book3S HV: Include prototypes
It fixes these W=1 compile errors : CC [M] arch/powerpc/kvm/book3s_64_mmu_hv.o ../arch/powerpc/kvm/book3s_64_mmu_hv.c:879:5: error: no previous prototype for ‘kvm_unmap_hva_range_hv’ [-Werror=missing-prototypes] 879 | int kvm_unmap_hva_range_hv(struct kvm *kvm, unsigned long start, unsigned long end) | ^~ ../arch/powerpc/kvm/book3s_64_mmu_hv.c:888:6: error: no previous prototype for ‘kvmppc_core_flush_memslot_hv’ [-Werror=missing-prototypes] 888 | void kvmppc_core_flush_memslot_hv(struct kvm *kvm, | ^~~~ ../arch/powerpc/kvm/book3s_64_mmu_hv.c:970:5: error: no previous prototype for ‘kvm_age_hva_hv’ [-Werror=missing-prototypes] 970 | int kvm_age_hva_hv(struct kvm *kvm, unsigned long start, unsigned long end) | ^~ ../arch/powerpc/kvm/book3s_64_mmu_hv.c:1011:5: error: no previous prototype for ‘kvm_test_age_hva_hv’ [-Werror=missing-prototypes] 1011 | int kvm_test_age_hva_hv(struct kvm *kvm, unsigned long hva) | ^~~ ../arch/powerpc/kvm/book3s_64_mmu_hv.c:1019:6: error: no previous prototype for ‘kvm_set_spte_hva_hv’ [-Werror=missing-prototypes] 1019 | void kvm_set_spte_hva_hv(struct kvm *kvm, unsigned long hva, pte_t pte) | ^~~ Cc: Paul Mackerras Signed-off-by: Cédric Le Goater --- arch/powerpc/kvm/book3s_64_mmu_hv.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/kvm/book3s_64_mmu_hv.c b/arch/powerpc/kvm/book3s_64_mmu_hv.c index 38ea396a23d6..c77f2d4f44ca 100644 --- a/arch/powerpc/kvm/book3s_64_mmu_hv.c +++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c @@ -27,6 +27,7 @@ #include #include +#include "book3s.h" #include "trace_hv.h" //#define DEBUG_RESIZE_HPT 1 -- 2.26.2
[PATCH v2 18/23] KVM: PPC: Make the VMX instruction emulation routines static
These are only used locally. It fixes these W=1 compile errors : ../arch/powerpc/kvm/powerpc.c:1521:5: error: no previous prototype for ‘kvmppc_get_vmx_dword’ [-Werror=missing-prototypes] 1521 | int kvmppc_get_vmx_dword(struct kvm_vcpu *vcpu, int index, u64 *val) | ^~~~ ../arch/powerpc/kvm/powerpc.c:1539:5: error: no previous prototype for ‘kvmppc_get_vmx_word’ [-Werror=missing-prototypes] 1539 | int kvmppc_get_vmx_word(struct kvm_vcpu *vcpu, int index, u64 *val) | ^~~ ../arch/powerpc/kvm/powerpc.c:1557:5: error: no previous prototype for ‘kvmppc_get_vmx_hword’ [-Werror=missing-prototypes] 1557 | int kvmppc_get_vmx_hword(struct kvm_vcpu *vcpu, int index, u64 *val) | ^~~~ ../arch/powerpc/kvm/powerpc.c:1575:5: error: no previous prototype for ‘kvmppc_get_vmx_byte’ [-Werror=missing-prototypes] 1575 | int kvmppc_get_vmx_byte(struct kvm_vcpu *vcpu, int index, u64 *val) | ^~~ Cc: Paul Mackerras Fixes: acc9eb9305fe ("KVM: PPC: Reimplement LOAD_VMX/STORE_VMX instruction mmio emulation with analyse_instr() input") Signed-off-by: Cédric Le Goater --- arch/powerpc/kvm/powerpc.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c index cf52d26f49cd..25966ae3271e 100644 --- a/arch/powerpc/kvm/powerpc.c +++ b/arch/powerpc/kvm/powerpc.c @@ -1518,7 +1518,7 @@ int kvmppc_handle_vmx_load(struct kvm_vcpu *vcpu, return emulated; } -int kvmppc_get_vmx_dword(struct kvm_vcpu *vcpu, int index, u64 *val) +static int kvmppc_get_vmx_dword(struct kvm_vcpu *vcpu, int index, u64 *val) { union kvmppc_one_reg reg; int vmx_offset = 0; @@ -1536,7 +1536,7 @@ int kvmppc_get_vmx_dword(struct kvm_vcpu *vcpu, int index, u64 *val) return result; } -int kvmppc_get_vmx_word(struct kvm_vcpu *vcpu, int index, u64 *val) +static int kvmppc_get_vmx_word(struct kvm_vcpu *vcpu, int index, u64 *val) { union kvmppc_one_reg reg; int vmx_offset = 0; @@ -1554,7 +1554,7 @@ int kvmppc_get_vmx_word(struct kvm_vcpu *vcpu, int index, u64 *val) return result; } -int kvmppc_get_vmx_hword(struct kvm_vcpu *vcpu, int index, u64 *val) +static int kvmppc_get_vmx_hword(struct kvm_vcpu *vcpu, int index, u64 *val) { union kvmppc_one_reg reg; int vmx_offset = 0; @@ -1572,7 +1572,7 @@ int kvmppc_get_vmx_hword(struct kvm_vcpu *vcpu, int index, u64 *val) return result; } -int kvmppc_get_vmx_byte(struct kvm_vcpu *vcpu, int index, u64 *val) +static int kvmppc_get_vmx_byte(struct kvm_vcpu *vcpu, int index, u64 *val) { union kvmppc_one_reg reg; int vmx_offset = 0; -- 2.26.2
[PATCH v2 16/23] powerpc/mm: Declare arch_report_meminfo() prototype.
It fixes this W=1 compile error : ../arch/powerpc/mm/book3s64/pgtable.c:411:6: error: no previous prototype for ‘arch_report_meminfo’ [-Werror=missing-prototypes] 411 | void arch_report_meminfo(struct seq_file *m) | ^~~ Cc: "Aneesh Kumar K.V" Signed-off-by: Cédric Le Goater --- arch/powerpc/include/asm/pgtable.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/powerpc/include/asm/pgtable.h b/arch/powerpc/include/asm/pgtable.h index f7613f43c9cf..4eed82172e33 100644 --- a/arch/powerpc/include/asm/pgtable.h +++ b/arch/powerpc/include/asm/pgtable.h @@ -162,6 +162,9 @@ static inline bool is_ioremap_addr(const void *x) return addr >= IOREMAP_BASE && addr < IOREMAP_END; } + +struct seq_file; +void arch_report_meminfo(struct seq_file *m); #endif /* CONFIG_PPC64 */ #endif /* __ASSEMBLY__ */ -- 2.26.2
[PATCH v2 14/23] powerpc/mm: Declare preload_new_slb_context() prototype
It fixes this W=1 compile error : ../arch/powerpc/mm/book3s64/slb.c:380:6: error: no previous prototype for ‘preload_new_slb_context’ [-Werror=missing-prototypes] 380 | void preload_new_slb_context(unsigned long start, unsigned long sp) | ^~~ Cc: "Aneesh Kumar K.V" Signed-off-by: Cédric Le Goater --- arch/powerpc/include/asm/book3s/64/mmu-hash.h | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h b/arch/powerpc/include/asm/book3s/64/mmu-hash.h index 2bffc7a0fdb8..f911bdb68d8b 100644 --- a/arch/powerpc/include/asm/book3s/64/mmu-hash.h +++ b/arch/powerpc/include/asm/book3s/64/mmu-hash.h @@ -525,6 +525,7 @@ void slb_dump_contents(struct slb_entry *slb_ptr); extern void slb_vmalloc_update(void); extern void slb_set_size(u16 size); +void preload_new_slb_context(unsigned long start, unsigned long sp); #endif /* __ASSEMBLY__ */ /* -- 2.26.2
[PATCH v2 23/23] powerpc/pseries/eeh: Make pseries_send_allow_unfreeze() static
Only used locally. It fixes this W=1 compile error : ../arch/powerpc/platforms/pseries/eeh_pseries.c:697:5: error: no previous prototype for ‘pseries_send_allow_unfreeze’ [-Werror=missing-prototypes] 697 | int pseries_send_allow_unfreeze(struct pci_dn *pdn, | ^~~ Cc: Frederic Barrat Signed-off-by: Cédric Le Goater --- arch/powerpc/platforms/pseries/eeh_pseries.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c index de45ceb634f9..bc15200852b7 100644 --- a/arch/powerpc/platforms/pseries/eeh_pseries.c +++ b/arch/powerpc/platforms/pseries/eeh_pseries.c @@ -694,8 +694,7 @@ static int pseries_eeh_write_config(struct eeh_dev *edev, int where, int size, u } #ifdef CONFIG_PCI_IOV -int pseries_send_allow_unfreeze(struct pci_dn *pdn, - u16 *vf_pe_array, int cur_vfs) +static int pseries_send_allow_unfreeze(struct pci_dn *pdn, u16 *vf_pe_array, int cur_vfs) { int rc; int ibm_allow_unfreeze = rtas_token("ibm,open-sriov-allow-unfreeze"); -- 2.26.2
[PATCH v2 02/23] powerpc/pseries/ras: Remove unused variable 'status'
The last use of 'status' was removed in 2012. Remove the variable to fix this W=1 compile error. ../arch/powerpc/platforms/pseries/ras.c: In function ‘ras_epow_interrupt’: ../arch/powerpc/platforms/pseries/ras.c:318:6: error: variable ‘status’ set but not used [-Werror=unused-but-set-variable] 318 | int status; | ^~ Fixes: 55fc0c561742 ("powerpc/pseries: Parse and handle EPOW interrupts") Cc: Mahesh Salgaonkar Cc: Ganesh Goudar Signed-off-by: Cédric Le Goater --- arch/powerpc/platforms/pseries/ras.c | 13 - 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c index 149cec2212e6..bcb614ffce6a 100644 --- a/arch/powerpc/platforms/pseries/ras.c +++ b/arch/powerpc/platforms/pseries/ras.c @@ -315,12 +315,10 @@ static irqreturn_t ras_hotplug_interrupt(int irq, void *dev_id) /* Handle environmental and power warning (EPOW) interrupts. */ static irqreturn_t ras_epow_interrupt(int irq, void *dev_id) { - int status; int state; int critical; - status = rtas_get_sensor_fast(EPOW_SENSOR_TOKEN, EPOW_SENSOR_INDEX, - &state); + rtas_get_sensor_fast(EPOW_SENSOR_TOKEN, EPOW_SENSOR_INDEX, &state); if (state > 3) critical = 1; /* Time Critical */ @@ -329,12 +327,9 @@ static irqreturn_t ras_epow_interrupt(int irq, void *dev_id) spin_lock(&ras_log_buf_lock); - status = rtas_call(ras_check_exception_token, 6, 1, NULL, - RTAS_VECTOR_EXTERNAL_INTERRUPT, - virq_to_hw(irq), - RTAS_EPOW_WARNING, - critical, __pa(&ras_log_buf), - rtas_get_error_log_max()); + rtas_call(ras_check_exception_token, 6, 1, NULL, RTAS_VECTOR_EXTERNAL_INTERRUPT, + virq_to_hw(irq), RTAS_EPOW_WARNING, critical, __pa(&ras_log_buf), + rtas_get_error_log_max()); log_error(ras_log_buf, ERR_TYPE_RTAS_LOG, 0); -- 2.26.2
[PATCH v2 09/23] powerpc/smp: Make debugger_ipi_callback() static
debugger_ipi_callback() is a local routine used as a NMI IPI handler and does not need to be external. It fixes this W=1 compile error : ../arch/powerpc/kernel/smp.c:579:6: error: no previous prototype for ‘debugger_ipi_callback’ [-Werror=missing-prototypes] 579 | void debugger_ipi_callback(struct pt_regs *regs) | ^ Signed-off-by: Cédric Le Goater --- arch/powerpc/kernel/smp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index a96d90d7c442..5a4d59a1070d 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -577,7 +577,7 @@ void tick_broadcast(const struct cpumask *mask) #endif #ifdef CONFIG_DEBUGGER -void debugger_ipi_callback(struct pt_regs *regs) +static void debugger_ipi_callback(struct pt_regs *regs) { debugger_ipi(regs); } -- 2.26.2
[PATCH v2 10/23] powerpc/optprobes: Remove unused routine patch_imm32_load_insns()
Commit 650b55b707fd ("powerpc: Add prefixed instructions to instruction data type") removed the use of patch_imm32_load_insns(). Clean it up to fix this W=1 compile error : ../arch/powerpc/kernel/optprobes.c:149:6: error: no previous prototype for ‘patch_imm32_load_insns’ [-Werror=missing-prototypes] 149 | void patch_imm32_load_insns(unsigned int val, kprobe_opcode_t *addr) Cc: Jordan Niethe Fixes: 650b55b707fd ("powerpc: Add prefixed instructions to instruction data type") Signed-off-by: Cédric Le Goater --- arch/powerpc/kernel/optprobes.c | 19 --- 1 file changed, 19 deletions(-) diff --git a/arch/powerpc/kernel/optprobes.c b/arch/powerpc/kernel/optprobes.c index 69bfe96884e2..da6b88b80ba4 100644 --- a/arch/powerpc/kernel/optprobes.c +++ b/arch/powerpc/kernel/optprobes.c @@ -141,25 +141,6 @@ void arch_remove_optimized_kprobe(struct optimized_kprobe *op) } } -/* - * emulate_step() requires insn to be emulated as - * second parameter. Load register 'r4' with the - * instruction. - */ -void patch_imm32_load_insns(unsigned int val, kprobe_opcode_t *addr) -{ - /* addis r4,0,(insn)@h */ - patch_instruction((struct ppc_inst *)addr, - ppc_inst(PPC_INST_ADDIS | ___PPC_RT(4) | - ((val >> 16) & 0x))); - addr++; - - /* ori r4,r4,(insn)@l */ - patch_instruction((struct ppc_inst *)addr, - ppc_inst(PPC_INST_ORI | ___PPC_RA(4) | - ___PPC_RS(4) | (val & 0x))); -} - /* * Generate instructions to load provided immediate 64-bit value * to register 'reg' and patch these instructions at 'addr'. -- 2.26.2
[PATCH v2 12/23] powerpc/mm: Declare some prototypes
It fixes this W=1 compile error : ../arch/powerpc/mm/book3s64/hash_utils.c:1515:5: error: no previous prototype for ‘__hash_page’ [-Werror=missing-prototypes] 1515 | int __hash_page(unsigned long trap, unsigned long ea, unsigned long dsisr, | ^~~ ../arch/powerpc/mm/book3s64/hash_utils.c:1850:6: error: no previous prototype for ‘low_hash_fault’ [-Werror=missing-prototypes] 1850 | void low_hash_fault(struct pt_regs *regs, unsigned long address, int rc) | ^~ Cc: "Aneesh Kumar K.V" Signed-off-by: Cédric Le Goater --- arch/powerpc/include/asm/book3s/64/mmu-hash.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h b/arch/powerpc/include/asm/book3s/64/mmu-hash.h index 066b1d34c7bc..cb95b16e9a7b 100644 --- a/arch/powerpc/include/asm/book3s/64/mmu-hash.h +++ b/arch/powerpc/include/asm/book3s/64/mmu-hash.h @@ -467,6 +467,8 @@ extern int hash_page_mm(struct mm_struct *mm, unsigned long ea, unsigned long flags); extern int hash_page(unsigned long ea, unsigned long access, unsigned long trap, unsigned long dsisr); +void low_hash_fault(struct pt_regs *regs, unsigned long address, int rc); +int __hash_page(unsigned long trap, unsigned long ea, unsigned long dsisr, unsigned long msr); int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid, pte_t *ptep, unsigned long trap, unsigned long flags, int ssize, unsigned int shift, unsigned int mmu_psize); -- 2.26.2
[PATCH v2 08/23] powerpc/smp: Include tick_broadcast() prototype
It fixes this W=1 compile error : ../arch/powerpc/kernel/smp.c:569:6: error: no previous prototype for ‘tick_broadcast’ [-Werror=missing-prototypes] 569 | void tick_broadcast(const struct cpumask *mask) | ^~ Cc: "Gautham R. Shenoy" Signed-off-by: Cédric Le Goater --- arch/powerpc/kernel/smp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c index 9e2246e80efd..a96d90d7c442 100644 --- a/arch/powerpc/kernel/smp.c +++ b/arch/powerpc/kernel/smp.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include -- 2.26.2
[PATCH v2 15/23] powerpc/mm/hugetlb: Make pseries_alloc_bootmem_huge_page() static
pseries_alloc_bootmem_huge_page() is only used locally in alloc_bootmem_huge_page() and does not need to be external. It fixes this W=1 compile error : ../arch/powerpc/mm/hugetlbpage.c:220:12: error: no previous prototype for ‘pseries_alloc_bootmem_huge_page’ [-Werror=missing-prototypes] 220 | int __init pseries_alloc_bootmem_huge_page(struct hstate *hstate) |^~~ Cc: "Aneesh Kumar K.V" Signed-off-by: Cédric Le Goater --- arch/powerpc/mm/hugetlbpage.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/mm/hugetlbpage.c b/arch/powerpc/mm/hugetlbpage.c index 8b3cc4d688e8..4e7d9b91f1da 100644 --- a/arch/powerpc/mm/hugetlbpage.c +++ b/arch/powerpc/mm/hugetlbpage.c @@ -217,7 +217,7 @@ void __init pseries_add_gpage(u64 addr, u64 page_size, unsigned long number_of_p } } -int __init pseries_alloc_bootmem_huge_page(struct hstate *hstate) +static int __init pseries_alloc_bootmem_huge_page(struct hstate *hstate) { struct huge_bootmem_page *m; if (nr_gpages == 0) -- 2.26.2
[PATCH v2 13/23] powerpc/mm: Move hpte_insert_repeating() prototype
It fixes this W=1 compile error : ../arch/powerpc/mm/book3s64/hash_utils.c:1867:6: error: no previous prototype for ‘hpte_insert_repeating’ [-Werror=missing-prototypes] 1867 | long hpte_insert_repeating(unsigned long hash, unsigned long vpn, | ^ Cc: "Aneesh Kumar K.V" Signed-off-by: Cédric Le Goater --- arch/powerpc/include/asm/book3s/64/mmu-hash.h | 2 ++ arch/powerpc/mm/book3s64/hash_hugetlbpage.c | 4 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/powerpc/include/asm/book3s/64/mmu-hash.h b/arch/powerpc/include/asm/book3s/64/mmu-hash.h index cb95b16e9a7b..2bffc7a0fdb8 100644 --- a/arch/powerpc/include/asm/book3s/64/mmu-hash.h +++ b/arch/powerpc/include/asm/book3s/64/mmu-hash.h @@ -454,6 +454,8 @@ static inline unsigned long hpt_hash(unsigned long vpn, #define HPTE_NOHPTE_UPDATE 0x2 #define HPTE_USE_KERNEL_KEY0x4 +long hpte_insert_repeating(unsigned long hash, unsigned long vpn, unsigned long pa, + unsigned long rlags, unsigned long vflags, int psize, int ssize); extern int __hash_page_4K(unsigned long ea, unsigned long access, unsigned long vsid, pte_t *ptep, unsigned long trap, unsigned long flags, int ssize, int subpage_prot); diff --git a/arch/powerpc/mm/book3s64/hash_hugetlbpage.c b/arch/powerpc/mm/book3s64/hash_hugetlbpage.c index b5e9fff8c217..a688e1324ae5 100644 --- a/arch/powerpc/mm/book3s64/hash_hugetlbpage.c +++ b/arch/powerpc/mm/book3s64/hash_hugetlbpage.c @@ -16,10 +16,6 @@ unsigned int hpage_shift; EXPORT_SYMBOL(hpage_shift); -extern long hpte_insert_repeating(unsigned long hash, unsigned long vpn, - unsigned long pa, unsigned long rlags, - unsigned long vflags, int psize, int ssize); - int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid, pte_t *ptep, unsigned long trap, unsigned long flags, int ssize, unsigned int shift, unsigned int mmu_psize) -- 2.26.2
[PATCH v2 11/23] powerpc/optprobes: Make patch_imm64_load_insns() static
patch_imm64_load_insns() is only used locally in arch_prepare_optimized_kprobe() and does not need to be external. It fixes this W=1 compile error : ../arch/powerpc/kernel/optprobes.c:149:6: error: no previous prototype for ‘patch_imm64_load_insns’ [-Werror=missing-prototypes] 149 | void patch_imm64_load_insns(unsigned int val, kprobe_opcode_t *addr) Cc: Jordan Niethe Signed-off-by: Cédric Le Goater --- arch/powerpc/kernel/optprobes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/kernel/optprobes.c b/arch/powerpc/kernel/optprobes.c index da6b88b80ba4..7f7cdbeacd1a 100644 --- a/arch/powerpc/kernel/optprobes.c +++ b/arch/powerpc/kernel/optprobes.c @@ -145,7 +145,7 @@ void arch_remove_optimized_kprobe(struct optimized_kprobe *op) * Generate instructions to load provided immediate 64-bit value * to register 'reg' and patch these instructions at 'addr'. */ -void patch_imm64_load_insns(unsigned long val, int reg, kprobe_opcode_t *addr) +static void patch_imm64_load_insns(unsigned long val, int reg, kprobe_opcode_t *addr) { /* lis reg,(op)@highest */ patch_instruction((struct ppc_inst *)addr, -- 2.26.2
[PATCH v2 04/23] powerpc/pseries/ras: Make init_ras_hotplug_IRQ() static
init_ras_hotplug_IRQ() is a local routine used by a machine init call and it doesn't need to be external. It fixes this W=1 compile error: ../arch/powerpc/platforms/pseries/ras.c:125:12: error: no previous prototype for ‘init_ras_hotplug_IRQ’ [-Werror=missing-prototypes] 125 | int __init init_ras_hotplug_IRQ(void) |^~~~ Fixes: c9dccf1d074a ("powerpc/pseries: Enable RAS hotplug events later") Cc: Mahesh Salgaonkar Cc: Ganesh Goudar Signed-off-by: Cédric Le Goater --- arch/powerpc/platforms/pseries/ras.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c index bcb614ffce6a..d2fca1aa6742 100644 --- a/arch/powerpc/platforms/pseries/ras.c +++ b/arch/powerpc/platforms/pseries/ras.c @@ -122,7 +122,7 @@ static inline u8 rtas_mc_error_sub_type(const struct pseries_mc_errorlog *mlog) * devices or systems (e.g. hugepages) that have not been initialized at the * subsys stage. */ -int __init init_ras_hotplug_IRQ(void) +static int __init init_ras_hotplug_IRQ(void) { struct device_node *np; -- 2.26.2
[PATCH v2 07/23] powerpc/mce: Include prototypes
It fixes these W=1 compile errors : ../arch/powerpc/kernel/mce.c:591:14: error: no previous prototype for ‘machine_check_early’ [-Werror=missing-prototypes] 591 | long notrace machine_check_early(struct pt_regs *regs) | ^~~ ../arch/powerpc/kernel/mce.c:725:6: error: no previous prototype for ‘hmi_exception_realmode’ [-Werror=missing-prototypes] 725 | long hmi_exception_realmode(struct pt_regs *regs) | ^~ Cc: Ganesh Goudar Cc: Mahesh Salgaonkar Signed-off-by: Cédric Le Goater --- arch/powerpc/kernel/mce.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/powerpc/kernel/mce.c b/arch/powerpc/kernel/mce.c index 9f3e133b57b7..c381dc2f9858 100644 --- a/arch/powerpc/kernel/mce.c +++ b/arch/powerpc/kernel/mce.c @@ -21,6 +21,7 @@ #include #include #include +#include static DEFINE_PER_CPU(int, mce_nest_count); static DEFINE_PER_CPU(struct machine_check_event[MAX_MC_EVT], mce_event); -- 2.26.2
[PATCH v2 03/23] powerpc/pseries/eeh: Make pseries_pcibios_bus_add_device() static
pseries_pcibios_bus_add_device() is a local routine defining the pcibios_bus_add_device() handler of the pseries machine in eeh_pseries_init(). It doesn't need to be external. It fixes this W=1 compile error: ../arch/powerpc/platforms/pseries/eeh_pseries.c:46:6: error: no previous prototype for ‘pseries_pcibios_bus_add_device’ [-Werror=missing-prototypes] 46 | void pseries_pcibios_bus_add_device(struct pci_dev *pdev) | ^~ Fixes: dae7253f9f78 ("powerpc/pseries: Add pseries SR-IOV Machine dependent calls") Cc: Alexey Kardashevskiy Cc: Frédéric Barrat Signed-off-by: Cédric Le Goater --- arch/powerpc/platforms/pseries/eeh_pseries.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/powerpc/platforms/pseries/eeh_pseries.c b/arch/powerpc/platforms/pseries/eeh_pseries.c index cf024fa37bda..de45ceb634f9 100644 --- a/arch/powerpc/platforms/pseries/eeh_pseries.c +++ b/arch/powerpc/platforms/pseries/eeh_pseries.c @@ -43,7 +43,7 @@ static int ibm_get_config_addr_info; static int ibm_get_config_addr_info2; static int ibm_configure_pe; -void pseries_pcibios_bus_add_device(struct pci_dev *pdev) +static void pseries_pcibios_bus_add_device(struct pci_dev *pdev) { struct pci_dn *pdn = pci_get_pdn(pdev); -- 2.26.2
Re: [PATCH 17/23] powerpc/watchdog: Declare soft_nmi_interrupt() prototype
On 12/21/20 9:48 AM, Christophe Leroy wrote: > > > Le 21/12/2020 à 08:42, Cédric Le Goater a écrit : >> It fixes this W=1 compile error : >> >> ../arch/powerpc/kernel/watchdog.c:250:6: error: no previous prototype for >> ‘soft_nmi_interrupt’ [-Werror=missing-prototypes] >> 250 | void soft_nmi_interrupt(struct pt_regs *regs) >> | ^~ >> >> Cc: Nicholas Piggin >> Signed-off-by: Cédric Le Goater >> --- >> arch/powerpc/include/asm/asm-prototypes.h | 1 + > > This is a misuse of asm/asm-prototypes.h yes. is a better place. Thanks for the review, C. > This file is for prototypes of ASM functions. > > See discussion at > https://patchwork.ozlabs.org/project/linuxppc-dev/patch/1463534212-4879-2-git-send-email-...@axtens.net/ > > >> arch/powerpc/kernel/watchdog.c | 1 + >> 2 files changed, 2 insertions(+) >> >> diff --git a/arch/powerpc/include/asm/asm-prototypes.h >> b/arch/powerpc/include/asm/asm-prototypes.h >> index d0b832cbbec8..0f39eefbd5a5 100644 >> --- a/arch/powerpc/include/asm/asm-prototypes.h >> +++ b/arch/powerpc/include/asm/asm-prototypes.h >> @@ -84,6 +84,7 @@ void machine_check_exception(struct pt_regs *regs); >> void emulation_assist_interrupt(struct pt_regs *regs); >> long do_slb_fault(struct pt_regs *regs, unsigned long ea); >> void do_bad_slb_fault(struct pt_regs *regs, unsigned long ea, long err); >> +void soft_nmi_interrupt(struct pt_regs *regs); >> /* signals, syscalls and interrupts */ >> long sys_swapcontext(struct ucontext __user *old_ctx, >> diff --git a/arch/powerpc/kernel/watchdog.c b/arch/powerpc/kernel/watchdog.c >> index af3c15a1d41e..855716f563ac 100644 >> --- a/arch/powerpc/kernel/watchdog.c >> +++ b/arch/powerpc/kernel/watchdog.c >> @@ -27,6 +27,7 @@ >> #include >> #include >> +#include >> /* >> * The powerpc watchdog ensures that each CPU is able to service timers. >>
Re: Regression for 32-bit ppc on PowerBook G4 Aluminum (bisected to commit d0e3fc69d00d)
Larry Finger writes: > I tested 5.11.0-rc1 and it booted OK. My problem is fixed. Thanks. cheers
Re: [PATCH v3 0/6] Memory corruption may occur due to incorrent tlb flush
On Thu, Mar 12, 2020 at 06:57:34PM +0530, Santosh Sivaraj wrote: > The TLB flush optimisation (a46cc7a90f: powerpc/mm/radix: Improve TLB/PWC > flushes) may result in random memory corruption. Any concurrent page-table > walk > could end up with a Use-after-Free. Even on UP this might give issues, since > mmu_gather is preemptible these days. An interrupt or preempted task accessing > user pages might stumble into the free page if the hardware caches page > directories. > > The series is a backport of the fix sent by Peter [1]. > > The first three patches are dependencies for the last patch (avoid potential > double flush). If the performance impact due to double flush is considered > trivial then the first three patches and last patch may be dropped. > > This is only for v4.19 stable. > > [1] https://patchwork.kernel.org/cover/11284843/ Sorry for the delay, now queued up, let's see what the test-builders say about it... thanks, greg k-h
Patch "powerpc/mmu_gather: enable RCU_TABLE_FREE even for !SMP case" has been added to the 4.19-stable tree
This is a note to let you know that I've just added the patch titled powerpc/mmu_gather: enable RCU_TABLE_FREE even for !SMP case to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: powerpc-mmu_gather-enable-rcu_table_free-even-for-smp-case.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From foo@baz Mon Jan 4 01:45:29 PM CET 2021 From: Santosh Sivaraj Date: Thu, 12 Mar 2020 18:57:38 +0530 Subject: powerpc/mmu_gather: enable RCU_TABLE_FREE even for !SMP case To: , linuxppc-dev Cc: Michael Ellerman , Greg KH , Sasha Levin , "Aneesh Kumar K.V" Message-ID: <20200312132740.225241-5-sant...@fossix.org> From: "Aneesh Kumar K.V" commit 12e4d53f3f04e81f9e83d6fc10edc7314ab9f6b9 upstream. Patch series "Fixup page directory freeing", v4. This is a repost of patch series from Peter with the arch specific changes except ppc64 dropped. ppc64 changes are added here because we are redoing the patch series on top of ppc64 changes. This makes it easy to backport these changes. Only the first 2 patches need to be backported to stable. The thing is, on anything SMP, freeing page directories should observe the exact same order as normal page freeing: 1) unhook page/directory 2) TLB invalidate 3) free page/directory Without this, any concurrent page-table walk could end up with a Use-after-Free. This is esp. trivial for anything that has software page-table walkers (HAVE_FAST_GUP / software TLB fill) or the hardware caches partial page-walks (ie. caches page directories). Even on UP this might give issues since mmu_gather is preemptible these days. An interrupt or preempted task accessing user pages might stumble into the free page if the hardware caches page directories. This patch series fixes ppc64 and add generic MMU_GATHER changes to support the conversion of other architectures. I haven't added patches w.r.t other architecture because they are yet to be acked. This patch (of 9): A followup patch is going to make sure we correctly invalidate page walk cache before we free page table pages. In order to keep things simple enable RCU_TABLE_FREE even for !SMP so that we don't have to fixup the !SMP case differently in the followup patch !SMP case is right now broken for radix translation w.r.t page walk cache flush. We can get interrupted in between page table free and that would imply we have page walk cache entries pointing to tables which got freed already. Michael said "both our platforms that run on Power9 force SMP on in Kconfig, so the !SMP case is unlikely to be a problem for anyone in practice, unless they've hacked their kernel to build it !SMP." Link: http://lkml.kernel.org/r/20200116064531.483522-2-aneesh.ku...@linux.ibm.com Signed-off-by: Aneesh Kumar K.V Cc: # 4.19 Signed-off-by: Santosh Sivaraj [santosh: backported for 4.19 stable] Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/Kconfig |2 +- arch/powerpc/include/asm/book3s/32/pgalloc.h |8 arch/powerpc/include/asm/book3s/64/pgalloc.h |2 -- arch/powerpc/include/asm/nohash/32/pgalloc.h |8 arch/powerpc/include/asm/nohash/64/pgalloc.h |9 + arch/powerpc/mm/pgtable-book3s64.c |7 --- 6 files changed, 2 insertions(+), 34 deletions(-) --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -216,7 +216,7 @@ config PPC select HAVE_HARDLOCKUP_DETECTOR_PERFif PERF_EVENTS && HAVE_PERF_EVENTS_NMI && !HAVE_HARDLOCKUP_DETECTOR_ARCH select HAVE_PERF_REGS select HAVE_PERF_USER_STACK_DUMP - select HAVE_RCU_TABLE_FREE if SMP + select HAVE_RCU_TABLE_FREE select HAVE_RCU_TABLE_NO_INVALIDATE if HAVE_RCU_TABLE_FREE select HAVE_REGS_AND_STACK_ACCESS_API select HAVE_RELIABLE_STACKTRACE if PPC64 && CPU_LITTLE_ENDIAN --- a/arch/powerpc/include/asm/book3s/32/pgalloc.h +++ b/arch/powerpc/include/asm/book3s/32/pgalloc.h @@ -110,7 +110,6 @@ static inline void pgtable_free(void *ta #define check_pgt_cache() do { } while (0) #define get_hugepd_cache_index(x) (x) -#ifdef CONFIG_SMP static inline void pgtable_free_tlb(struct mmu_gather *tlb, void *table, int shift) { @@ -127,13 +126,6 @@ static inline void __tlb_remove_table(vo pgtable_free(table, shift); } -#else -static inline void pgtable_free_tlb(struct mmu_gather *tlb, - void *table, int shift) -{ - pgtable_free(table, shift); -} -#endif static inline void __pte_free_tlb(struct mmu_gather *tlb, pgtable_t table, unsigned long address) --- a/arch/powerpc/include/asm/book3s/64/pgalloc.h +++ b/arch/powerpc/include/asm/book3s/64/pgalloc.h @@ -47,9 +47,7 @@ e
Patch "mm/mmu_gather: invalidate TLB correctly on batch allocation failure and flush" has been added to the 4.19-stable tree
This is a note to let you know that I've just added the patch titled mm/mmu_gather: invalidate TLB correctly on batch allocation failure and flush to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: mm-mmu_gather-invalidate-tlb-correctly-on-batch-allocation-failure-and-flush.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From foo@baz Mon Jan 4 01:45:29 PM CET 2021 From: Santosh Sivaraj Date: Thu, 12 Mar 2020 18:57:39 +0530 Subject: mm/mmu_gather: invalidate TLB correctly on batch allocation failure and flush To: , linuxppc-dev Cc: Michael Ellerman , Greg KH , Sasha Levin , Peter Zijlstra , "Aneesh Kumar K . V" Message-ID: <20200312132740.225241-6-sant...@fossix.org> From: Peter Zijlstra commit 0ed1325967ab5f7a4549a2641c6ebe115f76e228 upstream. Architectures for which we have hardware walkers of Linux page table should flush TLB on mmu gather batch allocation failures and batch flush. Some architectures like POWER supports multiple translation modes (hash and radix) and in the case of POWER only radix translation mode needs the above TLBI. This is because for hash translation mode kernel wants to avoid this extra flush since there are no hardware walkers of linux page table. With radix translation, the hardware also walks linux page table and with that, kernel needs to make sure to TLB invalidate page walk cache before page table pages are freed. More details in commit d86564a2f085 ("mm/tlb, x86/mm: Support invalidating TLB caches for RCU_TABLE_FREE") The changes to sparc are to make sure we keep the old behavior since we are now removing HAVE_RCU_TABLE_NO_INVALIDATE. The default value for tlb_needs_table_invalidate is to always force an invalidate and sparc can avoid the table invalidate. Hence we define tlb_needs_table_invalidate to false for sparc architecture. Link: http://lkml.kernel.org/r/20200116064531.483522-3-aneesh.ku...@linux.ibm.com Fixes: a46cc7a90fd8 ("powerpc/mm/radix: Improve TLB/PWC flushes") Signed-off-by: Peter Zijlstra (Intel) Cc: # 4.19 Signed-off-by: Santosh Sivaraj [santosh: backported to 4.19 stable] Signed-off-by: Greg Kroah-Hartman --- arch/Kconfig|3 --- arch/powerpc/Kconfig|1 - arch/powerpc/include/asm/tlb.h | 11 +++ arch/sparc/Kconfig |1 - arch/sparc/include/asm/tlb_64.h |9 + include/asm-generic/tlb.h | 15 +++ mm/memory.c | 16 7 files changed, 43 insertions(+), 13 deletions(-) --- a/arch/Kconfig +++ b/arch/Kconfig @@ -363,9 +363,6 @@ config HAVE_ARCH_JUMP_LABEL config HAVE_RCU_TABLE_FREE bool -config HAVE_RCU_TABLE_NO_INVALIDATE - bool - config ARCH_WANT_IRQS_OFF_ACTIVATE_MM bool help --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -217,7 +217,6 @@ config PPC select HAVE_PERF_REGS select HAVE_PERF_USER_STACK_DUMP select HAVE_RCU_TABLE_FREE - select HAVE_RCU_TABLE_NO_INVALIDATE if HAVE_RCU_TABLE_FREE select HAVE_REGS_AND_STACK_ACCESS_API select HAVE_RELIABLE_STACKTRACE if PPC64 && CPU_LITTLE_ENDIAN select HAVE_SYSCALL_TRACEPOINTS --- a/arch/powerpc/include/asm/tlb.h +++ b/arch/powerpc/include/asm/tlb.h @@ -30,6 +30,17 @@ #define tlb_remove_check_page_size_change tlb_remove_check_page_size_change extern void tlb_flush(struct mmu_gather *tlb); +/* + * book3s: + * Hash does not use the linux page-tables, so we can avoid + * the TLB invalidate for page-table freeing, Radix otoh does use the + * page-tables and needs the TLBI. + * + * nohash: + * We still do TLB invalidate in the __pte_free_tlb routine before we + * add the page table pages to mmu gather table batch. + */ +#define tlb_needs_table_invalidate() radix_enabled() /* Get the generic bits... */ #include --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -64,7 +64,6 @@ config SPARC64 select HAVE_KRETPROBES select HAVE_KPROBES select HAVE_RCU_TABLE_FREE if SMP - select HAVE_RCU_TABLE_NO_INVALIDATE if HAVE_RCU_TABLE_FREE select HAVE_MEMBLOCK_NODE_MAP select HAVE_ARCH_TRANSPARENT_HUGEPAGE select HAVE_DYNAMIC_FTRACE --- a/arch/sparc/include/asm/tlb_64.h +++ b/arch/sparc/include/asm/tlb_64.h @@ -28,6 +28,15 @@ void flush_tlb_pending(void); #define __tlb_remove_tlb_entry(tlb, ptep, address) do { } while (0) #define tlb_flush(tlb) flush_tlb_pending() +/* + * SPARC64's hardware TLB fill does not use the Linux page-tables + * and therefore we don't need a TLBI when freeing page-table pages. + */ + +#ifdef CONFIG_HAVE_RCU_TABLE_FREE +#define tlb_needs_table_invalidate() (false) +#endif + #include #endif /* _SPARC64_TLB_H */ --- a/include/asm-generi
Patch "asm-generic/tlb: Track which levels of the page tables have been cleared" has been added to the 4.19-stable tree
This is a note to let you know that I've just added the patch titled asm-generic/tlb: Track which levels of the page tables have been cleared to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: asm-generic-tlb-track-which-levels-of-the-page-tables-have-been-cleared.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From foo@baz Mon Jan 4 01:45:29 PM CET 2021 From: Santosh Sivaraj Date: Thu, 12 Mar 2020 18:57:36 +0530 Subject: asm-generic/tlb: Track which levels of the page tables have been cleared To: , linuxppc-dev Cc: Michael Ellerman , Greg KH , Sasha Levin , Will Deacon Message-ID: <20200312132740.225241-3-sant...@fossix.org> From: Will Deacon commit a6d60245d6d9b1caf66b0d94419988c4836980af upstream It is common for architectures with hugepage support to require only a single TLB invalidation operation per hugepage during unmap(), rather than iterating through the mapping at a PAGE_SIZE increment. Currently, however, the level in the page table where the unmap() operation occurs is not stored in the mmu_gather structure, therefore forcing architectures to issue additional TLB invalidation operations or to give up and over-invalidate by e.g. invalidating the entire TLB. Ideally, we could add an interval rbtree to the mmu_gather structure, which would allow us to associate the correct mapping granule with the various sub-mappings within the range being invalidated. However, this is costly in terms of book-keeping and memory management, so instead we approximate by keeping track of the page table levels that are cleared and provide a means to query the smallest granule required for invalidation. Signed-off-by: Will Deacon Cc: # 4.19 Signed-off-by: Santosh Sivaraj [santosh: prerequisite for upcoming tlbflush backports] Signed-off-by: Greg Kroah-Hartman --- include/asm-generic/tlb.h | 58 +++--- mm/memory.c |4 ++- 2 files changed, 53 insertions(+), 9 deletions(-) --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -114,6 +114,14 @@ struct mmu_gather { */ unsigned intfreed_tables : 1; + /* +* at which levels have we cleared entries? +*/ + unsigned intcleared_ptes : 1; + unsigned intcleared_pmds : 1; + unsigned intcleared_puds : 1; + unsigned intcleared_p4ds : 1; + struct mmu_gather_batch *active; struct mmu_gather_batch local; struct page *__pages[MMU_GATHER_BUNDLE]; @@ -148,6 +156,10 @@ static inline void __tlb_reset_range(str tlb->end = 0; } tlb->freed_tables = 0; + tlb->cleared_ptes = 0; + tlb->cleared_pmds = 0; + tlb->cleared_puds = 0; + tlb->cleared_p4ds = 0; } static inline void tlb_flush_mmu_tlbonly(struct mmu_gather *tlb) @@ -197,6 +209,25 @@ static inline void tlb_remove_check_page } #endif +static inline unsigned long tlb_get_unmap_shift(struct mmu_gather *tlb) +{ + if (tlb->cleared_ptes) + return PAGE_SHIFT; + if (tlb->cleared_pmds) + return PMD_SHIFT; + if (tlb->cleared_puds) + return PUD_SHIFT; + if (tlb->cleared_p4ds) + return P4D_SHIFT; + + return PAGE_SHIFT; +} + +static inline unsigned long tlb_get_unmap_size(struct mmu_gather *tlb) +{ + return 1UL << tlb_get_unmap_shift(tlb); +} + /* * In the case of tlb vma handling, we can optimise these away in the * case where we're doing a full MM flush. When we're doing a munmap, @@ -230,13 +261,19 @@ static inline void tlb_remove_check_page #define tlb_remove_tlb_entry(tlb, ptep, address) \ do {\ __tlb_adjust_range(tlb, address, PAGE_SIZE);\ + tlb->cleared_ptes = 1; \ __tlb_remove_tlb_entry(tlb, ptep, address); \ } while (0) -#define tlb_remove_huge_tlb_entry(h, tlb, ptep, address)\ - do { \ - __tlb_adjust_range(tlb, address, huge_page_size(h)); \ - __tlb_remove_tlb_entry(tlb, ptep, address); \ +#define tlb_remove_huge_tlb_entry(h, tlb, ptep, address) \ + do {\ + unsigned long _sz = huge_page_size(h); \ + __tlb_adjust_range(tlb, address, _sz); \ + if (_sz == PMD_SIZE)\ + tlb->cleared_pmds = 1; \ + else if (_sz == PUD_SIZE)
Patch "asm-generic/tlb: Track freeing of page-table directories in struct mmu_gather" has been added to the 4.19-stable tree
This is a note to let you know that I've just added the patch titled asm-generic/tlb: Track freeing of page-table directories in struct mmu_gather to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: asm-generic-tlb-track-freeing-of-page-table-directories-in-struct-mmu_gather.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From foo@baz Mon Jan 4 01:45:29 PM CET 2021 From: Santosh Sivaraj Date: Thu, 12 Mar 2020 18:57:35 +0530 Subject: asm-generic/tlb: Track freeing of page-table directories in struct mmu_gather To: , linuxppc-dev Cc: Michael Ellerman , Greg KH , Sasha Levin , Peter Zijlstra , Will Deacon Message-ID: <20200312132740.225241-2-sant...@fossix.org> From: Peter Zijlstra commit 22a61c3c4f1379ef8b0ce0d5cb78baf3178950e2 upstream Some architectures require different TLB invalidation instructions depending on whether it is only the last-level of page table being changed, or whether there are also changes to the intermediate (directory) entries higher up the tree. Add a new bit to the flags bitfield in struct mmu_gather so that the architecture code can operate accordingly if it's the intermediate levels being invalidated. Signed-off-by: Peter Zijlstra Signed-off-by: Will Deacon Cc: # 4.19 Signed-off-by: Santosh Sivaraj [santosh: prerequisite for tlbflush backports] Signed-off-by: Greg Kroah-Hartman --- include/asm-generic/tlb.h | 31 +++ 1 file changed, 23 insertions(+), 8 deletions(-) --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -97,12 +97,22 @@ struct mmu_gather { #endif unsigned long start; unsigned long end; - /* we are in the middle of an operation to clear -* a full mm and can make some optimizations */ - unsigned intfullmm : 1, - /* we have performed an operation which -* requires a complete flush of the tlb */ - need_flush_all : 1; + /* +* we are in the middle of an operation to clear +* a full mm and can make some optimizations +*/ + unsigned intfullmm : 1; + + /* +* we have performed an operation which +* requires a complete flush of the tlb +*/ + unsigned intneed_flush_all : 1; + + /* +* we have removed page directories +*/ + unsigned intfreed_tables : 1; struct mmu_gather_batch *active; struct mmu_gather_batch local; @@ -137,6 +147,7 @@ static inline void __tlb_reset_range(str tlb->start = TASK_SIZE; tlb->end = 0; } + tlb->freed_tables = 0; } static inline void tlb_flush_mmu_tlbonly(struct mmu_gather *tlb) @@ -278,6 +289,7 @@ static inline void tlb_remove_check_page #define pte_free_tlb(tlb, ptep, address) \ do {\ __tlb_adjust_range(tlb, address, PAGE_SIZE);\ + tlb->freed_tables = 1; \ __pte_free_tlb(tlb, ptep, address); \ } while (0) #endif @@ -285,7 +297,8 @@ static inline void tlb_remove_check_page #ifndef pmd_free_tlb #define pmd_free_tlb(tlb, pmdp, address) \ do {\ - __tlb_adjust_range(tlb, address, PAGE_SIZE);\ + __tlb_adjust_range(tlb, address, PAGE_SIZE);\ + tlb->freed_tables = 1; \ __pmd_free_tlb(tlb, pmdp, address); \ } while (0) #endif @@ -295,6 +308,7 @@ static inline void tlb_remove_check_page #define pud_free_tlb(tlb, pudp, address) \ do {\ __tlb_adjust_range(tlb, address, PAGE_SIZE);\ + tlb->freed_tables = 1; \ __pud_free_tlb(tlb, pudp, address); \ } while (0) #endif @@ -304,7 +318,8 @@ static inline void tlb_remove_check_page #ifndef p4d_free_tlb #define p4d_free_tlb(tlb, pudp, address) \ do {\ - __tlb_adjust_range(tlb, address, PAGE_SIZE);\ + __tlb_adjust_range(tlb, address, PAGE_SIZE);\ + tlb->freed_tables = 1; \ __p4d_free_tlb(tlb, pudp, address); \ } while (0) #endif Patches currently in stable-queue which might be from sant...@fossix.org are queue-4.19/asm-generic-tlb-track-which-levels-of-the-page-tables-have-been-cleared.patch q
Patch "asm-generic/tlb: avoid potential double flush" has been added to the 4.19-stable tree
This is a note to let you know that I've just added the patch titled asm-generic/tlb: avoid potential double flush to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: asm-generic-tlb-avoid-potential-double-flush.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From foo@baz Mon Jan 4 01:45:29 PM CET 2021 From: Santosh Sivaraj Date: Thu, 12 Mar 2020 18:57:40 +0530 Subject: asm-generic/tlb: avoid potential double flush To: , linuxppc-dev Cc: Michael Ellerman , Greg KH , Sasha Levin , Peter Zijlstra , "Aneesh Kumar K . V" Message-ID: <20200312132740.225241-7-sant...@fossix.org> From: Peter Zijlstra commit 0758cd8304942292e95a0f750c374533db378b32 upstream. Aneesh reported that: tlb_flush_mmu() tlb_flush_mmu_tlbonly() tlb_flush() <-- #1 tlb_flush_mmu_free() tlb_table_flush() tlb_table_invalidate() tlb_flush_mmu_tlbonly() tlb_flush() <-- #2 does two TLBIs when tlb->fullmm, because __tlb_reset_range() will not clear tlb->end in that case. Observe that any caller to __tlb_adjust_range() also sets at least one of the tlb->freed_tables || tlb->cleared_p* bits, and those are unconditionally cleared by __tlb_reset_range(). Change the condition for actually issuing TLBI to having one of those bits set, as opposed to having tlb->end != 0. Link: http://lkml.kernel.org/r/20200116064531.483522-4-aneesh.ku...@linux.ibm.com Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Aneesh Kumar K.V Reported-by: "Aneesh Kumar K.V" Cc: # 4.19 Signed-off-by: Santosh Sivaraj [santosh: backported to 4.19 stable] Signed-off-by: Greg Kroah-Hartman --- include/asm-generic/tlb.h |7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) --- a/include/asm-generic/tlb.h +++ b/include/asm-generic/tlb.h @@ -179,7 +179,12 @@ static inline void __tlb_reset_range(str static inline void tlb_flush_mmu_tlbonly(struct mmu_gather *tlb) { - if (!tlb->end) + /* +* Anything calling __tlb_adjust_range() also sets at least one of +* these bits. +*/ + if (!(tlb->freed_tables || tlb->cleared_ptes || tlb->cleared_pmds || + tlb->cleared_puds || tlb->cleared_p4ds)) return; tlb_flush(tlb); Patches currently in stable-queue which might be from sant...@fossix.org are queue-4.19/asm-generic-tlb-track-which-levels-of-the-page-tables-have-been-cleared.patch queue-4.19/asm-generic-tlb-track-freeing-of-page-table-directories-in-struct-mmu_gather.patch queue-4.19/asm-generic-tlb-avoid-potential-double-flush.patch queue-4.19/mm-mmu_gather-invalidate-tlb-correctly-on-batch-allocation-failure-and-flush.patch queue-4.19/powerpc-mmu_gather-enable-rcu_table_free-even-for-smp-case.patch queue-4.19/asm-generic-tlb-arch-invert-config_have_rcu_table_invalidate.patch
Patch "asm-generic/tlb, arch: Invert CONFIG_HAVE_RCU_TABLE_INVALIDATE" has been added to the 4.19-stable tree
This is a note to let you know that I've just added the patch titled asm-generic/tlb, arch: Invert CONFIG_HAVE_RCU_TABLE_INVALIDATE to the 4.19-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: asm-generic-tlb-arch-invert-config_have_rcu_table_invalidate.patch and it can be found in the queue-4.19 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >From foo@baz Mon Jan 4 01:45:29 PM CET 2021 From: Santosh Sivaraj Date: Thu, 12 Mar 2020 18:57:37 +0530 Subject: asm-generic/tlb, arch: Invert CONFIG_HAVE_RCU_TABLE_INVALIDATE To: , linuxppc-dev Cc: Michael Ellerman , Greg KH , Sasha Levin , Peter Zijlstra Message-ID: <20200312132740.225241-4-sant...@fossix.org> From: Peter Zijlstra commit 96bc9567cbe112e9320250f01b9c060c882e8619 upstream. Make issuing a TLB invalidate for page-table pages the normal case. The reason is twofold: - too many invalidates is safer than too few, - most architectures use the linux page-tables natively and would thus require this. Make it an opt-out, instead of an opt-in. No change in behavior intended. Signed-off-by: Peter Zijlstra (Intel) Cc: # 4.19 Signed-off-by: Santosh Sivaraj [santosh: prerequisite for upcoming tlbflush backports] Signed-off-by: Greg Kroah-Hartman --- arch/Kconfig |2 +- arch/powerpc/Kconfig |1 + arch/sparc/Kconfig |1 + arch/x86/Kconfig |1 - mm/memory.c |2 +- 5 files changed, 4 insertions(+), 3 deletions(-) --- a/arch/Kconfig +++ b/arch/Kconfig @@ -363,7 +363,7 @@ config HAVE_ARCH_JUMP_LABEL config HAVE_RCU_TABLE_FREE bool -config HAVE_RCU_TABLE_INVALIDATE +config HAVE_RCU_TABLE_NO_INVALIDATE bool config ARCH_WANT_IRQS_OFF_ACTIVATE_MM --- a/arch/powerpc/Kconfig +++ b/arch/powerpc/Kconfig @@ -217,6 +217,7 @@ config PPC select HAVE_PERF_REGS select HAVE_PERF_USER_STACK_DUMP select HAVE_RCU_TABLE_FREE if SMP + select HAVE_RCU_TABLE_NO_INVALIDATE if HAVE_RCU_TABLE_FREE select HAVE_REGS_AND_STACK_ACCESS_API select HAVE_RELIABLE_STACKTRACE if PPC64 && CPU_LITTLE_ENDIAN select HAVE_SYSCALL_TRACEPOINTS --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -64,6 +64,7 @@ config SPARC64 select HAVE_KRETPROBES select HAVE_KPROBES select HAVE_RCU_TABLE_FREE if SMP + select HAVE_RCU_TABLE_NO_INVALIDATE if HAVE_RCU_TABLE_FREE select HAVE_MEMBLOCK_NODE_MAP select HAVE_ARCH_TRANSPARENT_HUGEPAGE select HAVE_DYNAMIC_FTRACE --- a/arch/x86/Kconfig +++ b/arch/x86/Kconfig @@ -181,7 +181,6 @@ config X86 select HAVE_PERF_REGS select HAVE_PERF_USER_STACK_DUMP select HAVE_RCU_TABLE_FREE if PARAVIRT - select HAVE_RCU_TABLE_INVALIDATEif HAVE_RCU_TABLE_FREE select HAVE_REGS_AND_STACK_ACCESS_API select HAVE_RELIABLE_STACKTRACE if X86_64 && (UNWINDER_FRAME_POINTER || UNWINDER_ORC) && STACK_VALIDATION select HAVE_STACKPROTECTOR if CC_HAS_SANE_STACKPROTECTOR --- a/mm/memory.c +++ b/mm/memory.c @@ -339,7 +339,7 @@ bool __tlb_remove_page_size(struct mmu_g */ static inline void tlb_table_invalidate(struct mmu_gather *tlb) { -#ifdef CONFIG_HAVE_RCU_TABLE_INVALIDATE +#ifndef CONFIG_HAVE_RCU_TABLE_NO_INVALIDATE /* * Invalidate page-table caches used by hardware walkers. Then we still * need to RCU-sched wait while freeing the pages because software Patches currently in stable-queue which might be from sant...@fossix.org are queue-4.19/asm-generic-tlb-track-which-levels-of-the-page-tables-have-been-cleared.patch queue-4.19/asm-generic-tlb-track-freeing-of-page-table-directories-in-struct-mmu_gather.patch queue-4.19/asm-generic-tlb-avoid-potential-double-flush.patch queue-4.19/mm-mmu_gather-invalidate-tlb-correctly-on-batch-allocation-failure-and-flush.patch queue-4.19/powerpc-mmu_gather-enable-rcu_table_free-even-for-smp-case.patch queue-4.19/asm-generic-tlb-arch-invert-config_have_rcu_table_invalidate.patch
Re: [PATCH v9 05/12] mm: HUGE_VMAP arch support cleanup
On 2020/12/5 14:57, Nicholas Piggin wrote: > This changes the awkward approach where architectures provide init > functions to determine which levels they can provide large mappings for, > to one where the arch is queried for each call. > > This removes code and indirection, and allows constant-folding of dead > code for unsupported levels. > > This also adds a prot argument to the arch query. This is unused > currently but could help with some architectures (e.g., some powerpc > processors can't map uncacheable memory with large pages). > > Cc: linuxppc-dev@lists.ozlabs.org > Cc: Catalin Marinas > Cc: Will Deacon > Cc: linux-arm-ker...@lists.infradead.org > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: Borislav Petkov > Cc: x...@kernel.org > Cc: "H. Peter Anvin" > Acked-by: Catalin Marinas [arm64] > Signed-off-by: Nicholas Piggin > --- > arch/arm64/include/asm/vmalloc.h | 8 +++ > arch/arm64/mm/mmu.c | 10 +-- > arch/powerpc/include/asm/vmalloc.h | 8 +++ > arch/powerpc/mm/book3s64/radix_pgtable.c | 8 +-- > arch/x86/include/asm/vmalloc.h | 7 ++ > arch/x86/mm/ioremap.c| 10 +-- > include/linux/io.h | 9 --- > include/linux/vmalloc.h | 6 ++ > init/main.c | 1 - > mm/ioremap.c | 88 +--- > 10 files changed, 77 insertions(+), 78 deletions(-) > > diff --git a/arch/arm64/include/asm/vmalloc.h > b/arch/arm64/include/asm/vmalloc.h > index 2ca708ab9b20..597b40405319 100644 > --- a/arch/arm64/include/asm/vmalloc.h > +++ b/arch/arm64/include/asm/vmalloc.h > @@ -1,4 +1,12 @@ > #ifndef _ASM_ARM64_VMALLOC_H > #define _ASM_ARM64_VMALLOC_H > > +#include > + > +#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP > +bool arch_vmap_p4d_supported(pgprot_t prot); > +bool arch_vmap_pud_supported(pgprot_t prot); > +bool arch_vmap_pmd_supported(pgprot_t prot); > +#endif > + > #endif /* _ASM_ARM64_VMALLOC_H */ > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index ca692a815731..1b60079c1cef 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -1315,12 +1315,12 @@ void *__init fixmap_remap_fdt(phys_addr_t dt_phys, > int *size, pgprot_t prot) > return dt_virt; > } > > -int __init arch_ioremap_p4d_supported(void) > +bool arch_vmap_p4d_supported(pgprot_t prot) > { > - return 0; > + return false; > } > I think you should put this function in the CONFIG_HAVE_ARCH_HUGE_VMAP, otherwise it may break the compile when disable the CONFIG_HAVE_ARCH_HUGE_VMAP, the same as the x86 and ppc. Ding > -int __init arch_ioremap_pud_supported(void) > +bool arch_vmap_pud_supported(pgprot_t prot); > { > /* >* Only 4k granule supports level 1 block mappings. > @@ -1330,9 +1330,9 @@ int __init arch_ioremap_pud_supported(void) > !IS_ENABLED(CONFIG_PTDUMP_DEBUGFS); > } > > -int __init arch_ioremap_pmd_supported(void) > +bool arch_vmap_pmd_supported(pgprot_t prot) > { > - /* See arch_ioremap_pud_supported() */ > + /* See arch_vmap_pud_supported() */ > return !IS_ENABLED(CONFIG_PTDUMP_DEBUGFS); > } > > diff --git a/arch/powerpc/include/asm/vmalloc.h > b/arch/powerpc/include/asm/vmalloc.h > index b992dfaaa161..105abb73f075 100644 > --- a/arch/powerpc/include/asm/vmalloc.h > +++ b/arch/powerpc/include/asm/vmalloc.h > @@ -1,4 +1,12 @@ > #ifndef _ASM_POWERPC_VMALLOC_H > #define _ASM_POWERPC_VMALLOC_H > > +#include > + > +#ifdef CONFIG_HAVE_ARCH_HUGE_VMAP > +bool arch_vmap_p4d_supported(pgprot_t prot); > +bool arch_vmap_pud_supported(pgprot_t prot); > +bool arch_vmap_pmd_supported(pgprot_t prot); > +#endif > + > #endif /* _ASM_POWERPC_VMALLOC_H */ > diff --git a/arch/powerpc/mm/book3s64/radix_pgtable.c > b/arch/powerpc/mm/book3s64/radix_pgtable.c > index 3adcf730f478..ab426fc0cd4b 100644 > --- a/arch/powerpc/mm/book3s64/radix_pgtable.c > +++ b/arch/powerpc/mm/book3s64/radix_pgtable.c > @@ -1121,13 +1121,13 @@ void radix__ptep_modify_prot_commit(struct > vm_area_struct *vma, > set_pte_at(mm, addr, ptep, pte); > } > > -int __init arch_ioremap_pud_supported(void) > +bool arch_vmap_pud_supported(pgprot_t prot) > { > /* HPT does not cope with large pages in the vmalloc area */ > return radix_enabled(); > } > > -int __init arch_ioremap_pmd_supported(void) > +bool arch_vmap_pmd_supported(pgprot_t prot) > { > return radix_enabled(); > } > @@ -1221,7 +1221,7 @@ int pmd_free_pte_page(pmd_t *pmd, unsigned long addr) > return 1; > } > > -int __init arch_ioremap_p4d_supported(void) > +bool arch_vmap_p4d_supported(pgprot_t prot) > { > - return 0; > + return false; > } > diff --git a/arch/x86/include/asm/vmalloc.h b/arch/x86/include/asm/vmalloc.h > index 29837740b520..094ea2b565f3 100644 > --- a/arch/x86/include/asm/vmalloc.h > +++ b/arch/x86/include/asm/vmalloc.h > @@ -1,6 +1,13 @@ > #ifndef _ASM_X86_VMALLOC_H > #define _ASM_X86_V
[PATCH] tools headers UAPI: Sync linux/types.h with the kernel sources
Unlike the other headers in tools/include/uapi/linux, types.h has never been synced from the exported headers, instead it's been hand written over time. This means it doesn't match the exported headers which can cause build errors on some architectures. For example on powerpc, tools/bpf doesn't build: $ make O=/build -C tools/bpf/ make: Entering directory '/linux/tools/bpf' Auto-detecting system features: ...libbfd: [ on ] ...disassembler-four-args: [ on ] CC /build/bpf_jit_disasm.o LINK /build/bpf_jit_disasm CC /build/bpf_dbg.o In file included from /usr/include/powerpc64le-linux-gnu/asm/sigcontext.h:14, from /usr/include/powerpc64le-linux-gnu/bits/sigcontext.h:30, from /usr/include/signal.h:288, from /linux/tools/bpf/bpf_dbg.c:51: /usr/include/powerpc64le-linux-gnu/asm/elf.h:160:9: error: unknown type name '__vector128' 160 | typedef __vector128 elf_vrreg_t; | ^~~ make: *** [Makefile:67: /build/bpf_dbg.o] Error 1 This is because tools/include/uapi/linux/types.h doesn't include asm/types.h, where __vector128 is defined in the powerpc headers. We can fix it by syncing the tools header with the exported kernel header, as is done for the other headers in tools/include/uapi/linux. Reported-by: Vitaly Chikunov Signed-off-by: Michael Ellerman --- Earlier discussion: https://lore.kernel.org/netdev/20201024203040.4cjxnxrdy6qx5...@altlinux.org/ Build tested on powerpc and x86. --- tools/include/uapi/linux/types.h | 41 ++-- 1 file changed, 34 insertions(+), 7 deletions(-) diff --git a/tools/include/uapi/linux/types.h b/tools/include/uapi/linux/types.h index 91fa51a9c31d..999cb0fa88eb 100644 --- a/tools/include/uapi/linux/types.h +++ b/tools/include/uapi/linux/types.h @@ -1,11 +1,26 @@ -/* SPDX-License-Identifier: GPL-2.0 */ -#ifndef _UAPI_LINUX_TYPES_H -#define _UAPI_LINUX_TYPES_H +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef _LINUX_TYPES_H +#define _LINUX_TYPES_H -#include +#include + +#ifndef __ASSEMBLY__ + +#include + + +/* + * Below are truly Linux-specific types that should never collide with + * any application/library that wants linux/types.h. + */ + +#ifdef __CHECKER__ +#define __bitwise__ __attribute__((bitwise)) +#else +#define __bitwise__ +#endif +#define __bitwise __bitwise__ -/* copied from linux:include/uapi/linux/types.h */ -#define __bitwise typedef __u16 __bitwise __le16; typedef __u16 __bitwise __be16; typedef __u32 __bitwise __le32; @@ -16,8 +31,20 @@ typedef __u64 __bitwise __be64; typedef __u16 __bitwise __sum16; typedef __u32 __bitwise __wsum; +/* + * aligned_u64 should be used in defining kernel<->userspace ABIs to avoid + * common 32/64-bit compat problems. + * 64-bit values align to 4-byte boundaries on x86_32 (and possibly other + * architectures) and to 8-byte boundaries on 64-bit architectures. The new + * aligned_64 type enforces 8-byte alignment so that structs containing + * aligned_64 values have the same alignment on 32-bit and 64-bit architectures. + * No conversions are necessary between 32-bit user-space and a 64-bit kernel. + */ #define __aligned_u64 __u64 __attribute__((aligned(8))) #define __aligned_be64 __be64 __attribute__((aligned(8))) #define __aligned_le64 __le64 __attribute__((aligned(8))) -#endif /* _UAPI_LINUX_TYPES_H */ +typedef unsigned __bitwise __poll_t; + +#endif /* __ASSEMBLY__ */ +#endif /* _LINUX_TYPES_H */ -- 2.25.1
Re: [PATCH] selftests/powerpc: make the test check in eeh-basic.sh posix compliant
On 28/12/2020 05:34, Po-Hsu Lin wrote: The == operand is a bash extension, thus this will fail on Ubuntu with Error message is somehow missing. It should read: "./eeh-basic.sh: 89: test: 2: unexpected operator" As the /bin/sh on Ubuntu is pointed to DASH. Use -eq to fix this posix compatibility issue. Fixes: 996f9e0f93f162 ("selftests/powerpc: Fix eeh-basic.sh exit codes") Signed-off-by: Po-Hsu Lin --- With the above, Reviewed-by: Frederic Barrat Thanks! tools/testing/selftests/powerpc/eeh/eeh-basic.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/powerpc/eeh/eeh-basic.sh b/tools/testing/selftests/powerpc/eeh/eeh-basic.sh index 0d783e1..64779f0 100755 --- a/tools/testing/selftests/powerpc/eeh/eeh-basic.sh +++ b/tools/testing/selftests/powerpc/eeh/eeh-basic.sh @@ -86,5 +86,5 @@ echo "$failed devices failed to recover ($dev_count tested)" lspci | diff -u $pre_lspci - rm -f $pre_lspci -test "$failed" == 0 +test "$failed" -eq 0 exit $?
Re: [PATCH v2 -next] misc: ocxl: use DEFINE_MUTEX() for mutex lock
On 24/12/2020 14:24, Zheng Yongjun wrote: mutex lock can be initialized automatically with DEFINE_MUTEX() rather than explicitly calling mutex_init(). Signed-off-by: Zheng Yongjun --- Thanks! Acked-by: Frederic Barrat drivers/misc/ocxl/file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/misc/ocxl/file.c b/drivers/misc/ocxl/file.c index 4d1b44de1492..e70525eedaae 100644 --- a/drivers/misc/ocxl/file.c +++ b/drivers/misc/ocxl/file.c @@ -15,7 +15,7 @@ static dev_t ocxl_dev; static struct class *ocxl_class; -static struct mutex minors_idr_lock; +static DEFINE_MUTEX(minors_idr_lock); static struct idr minors_idr; static struct ocxl_file_info *find_and_get_file_info(dev_t devno) @@ -588,7 +588,6 @@ int ocxl_file_init(void) { int rc; - mutex_init(&minors_idr_lock); idr_init(&minors_idr); rc = alloc_chrdev_region(&ocxl_dev, 0, OCXL_NUM_MINORS, "ocxl");