RE: [patch 00/39] genirq, PCI/MSI: Support for per device MSI and PCI/IMS - Part 1 cleanups

2022-11-17 Thread Tian, Kevin
> From: Thomas Gleixner > Sent: Friday, November 11, 2022 9:54 PM > > Enough of history and theory. Here comes part 1: > > This is just a cleanup and a reorganisation of the PCI/MSI code which > became quite an unreadable mess over time. There is no intentional > functional change in this

Re: [PATCH mm-unstable v1 20/20] mm: rename FOLL_FORCE to FOLL_PTRACE

2022-11-17 Thread Kees Cook
On Wed, Nov 16, 2022 at 10:16:34AM -0800, Linus Torvalds wrote: > There _are_ also small random cases too, like get_cmdline(). Maybe > that counts as ptrace, but the execve() case most definitely does not. Oh, er, why does get_arg_page() even need FOLL_FORCE? This is writing the new stack

[PATCH v5 3/5] powerpc: mm: Add common pud_pfn stub for all platforms

2022-11-17 Thread Rohan McLure
Prior to this commit, pud_pfn was implemented with BUILD_BUG as the inline function for 64-bit Book3S systems but is never included, as its invocations in generic code are guarded by calls to pud_devmap which return zero on such systems. A future patch will provide support for page table checks,

RE: [patch 01/39] PCI/MSI: Check for MSI enabled in __pci_msix_enable()

2022-11-17 Thread Tian, Kevin
> From: Thomas Gleixner > Sent: Friday, November 11, 2022 9:54 PM > > PCI/MSI and PCI/MSI-X are mutually exclusive, but the MSI-X enable code > lacks a check for already enabled MSI. > > Signed-off-by: Thomas Gleixner > --- > drivers/pci/msi/msi.c |5 + > 1 file changed, 5

RE: [patch 33/39] PCI/MSI: Sanitize MSI-X checks

2022-11-17 Thread Tian, Kevin
> From: Thomas Gleixner > Sent: Friday, November 11, 2022 9:55 PM > > @@ -785,7 +786,7 @@ int __pci_enable_msix_range(struct pci_d > return -ENOSPC; > } > > - rc = __pci_enable_msix(dev, entries, nvec, affd, flags); > + rc =

[PATCH v5 1/5] powerpc: mm: Replace p{u,m,4}d_is_leaf with p{u,m,4}_leaf

2022-11-17 Thread Rohan McLure
Replace occurrences of p{u,m,4}d_is_leaf with p{u,m,4}_leaf, as the latter is the name given to checking that a higher-level entry in multi-level paging contains a page translation entry (pte) throughout all other archs. A future patch will implement p{u,m,4}_leaf stubs on all platforms so that

[PATCH v5 2/5] powerpc: mm: Implement p{m,u,4}d_leaf on all platforms

2022-11-17 Thread Rohan McLure
The check that a higher-level entry in multi-level pages contains a page translation entry (pte) is performed by p{m,u,4}d_leaf stubs, which may be specialised for each choice of mmu. In a prior commit, we replace uses to the catch-all stubs, p{m,u,4}d_is_leaf with p{m,u,4}d_leaf. Replace the

[PATCH v5 5/5] powerpc: mm: support page table check

2022-11-17 Thread Rohan McLure
On creation and clearing of a page table mapping, instrument such calls by invoking page_table_check_pte_set and page_table_check_pte_clear respectively. These calls serve as a sanity check against illegal mappings. Enable ARCH_SUPPORTS_PAGE_TABLE_CHECK for all ppc64, and 32-bit platforms

[PATCH v5 4/5] powerpc: mm: add p{te,md,ud}_user_accessible_page helpers

2022-11-17 Thread Rohan McLure
Add the following helpers for detecting whether a page table entry is a leaf and is accessible to user space. * pte_user_accessible_page * pmd_user_accessible_page * pud_user_accessible_page Also implement missing pud_user definitions for both Book3S/nohash 64-bit systems, and pmd_user for

Re: [PATCH mm-unstable v1 20/20] mm: rename FOLL_FORCE to FOLL_PTRACE

2022-11-17 Thread Linus Torvalds
On Thu, Nov 17, 2022 at 2:58 PM Kees Cook wrote: > > Oh, er, why does get_arg_page() even need FOLL_FORCE? This is writing the > new stack contents to the nascent brpm->vma, which was newly allocated > with VM_STACK_FLAGS, which an arch can override, but they all appear to > include > VM_WRITE |

Re: [PATCH mm-unstable v1 20/20] mm: rename FOLL_FORCE to FOLL_PTRACE

2022-11-17 Thread Kees Cook
On Thu, Nov 17, 2022 at 03:20:01PM -0800, Linus Torvalds wrote: > On Thu, Nov 17, 2022 at 2:58 PM Kees Cook wrote: > > > > Oh, er, why does get_arg_page() even need FOLL_FORCE? This is writing the > > new stack contents to the nascent brpm->vma, which was newly allocated > > with VM_STACK_FLAGS,

[PATCH v7 0/2] arm64: support batched/deferred tlb shootdown during page reclamation

2022-11-17 Thread Yicong Yang
From: Yicong Yang Though ARM64 has the hardware to do tlb shootdown, the hardware broadcasting is not free. A simplest micro benchmark shows even on snapdragon 888 with only 8 cores, the overhead for ptep_clear_flush is huge even for paging out one page mapped by only one process: 5.36% a.out

Re: [patch 34/39] PCI/MSI: Reject multi-MSI early

2022-11-17 Thread Thomas Gleixner
On Wed, Nov 16 2022 at 10:31, Bjorn Helgaas wrote: > On Fri, Nov 11, 2022 at 02:55:09PM +0100, Thomas Gleixner wrote: >> >> +/** >> + * pci_msi_domain_supports - Check for support of a particular feature flag >> + * @pdev: The PCI device to operate on >> + * @feature_mask: The

Re: [RFC PATCH v2 4/8] smp: Trace IPIs sent via arch_send_call_function_ipi_mask()

2022-11-17 Thread Peter Zijlstra
On Wed, Nov 02, 2022 at 06:33:32PM +, Valentin Schneider wrote: > This simply wraps around the arch function and prepends it with a > tracepoint, similar to send_call_function_single_ipi(). > > Signed-off-by: Valentin Schneider > --- > kernel/smp.c | 9 - > 1 file changed, 8

Re: [RFC PATCH v2 6/8] treewide: Trace IPIs sent via smp_send_reschedule()

2022-11-17 Thread Peter Zijlstra
On Wed, Nov 02, 2022 at 06:33:34PM +, Valentin Schneider wrote: > diff --git a/kernel/smp.c b/kernel/smp.c > index c4d561cf50d45..44fa4b9b1f46b 100644 > --- a/kernel/smp.c > +++ b/kernel/smp.c > @@ -167,6 +167,14 @@ send_call_function_ipi_mask(const struct cpumask *mask) >

Re: [PATCH v2 3/3] treewide: use get_random_u32_between() when possible

2022-11-17 Thread Russell King (Oracle)
On Thu, Nov 17, 2022 at 03:05:14AM +0100, Jason A. Donenfeld wrote: > On Thu, Nov 17, 2022 at 12:55:47AM +0100, Jason A. Donenfeld wrote: > > 1) How/whether to make f(0, UR2_MAX) safe, > >- without additional 64-bit arithmetic, > >- minimizing the number of branches. > >I have a few

[PATCH mm-unstable v1 00/20] mm/gup: remove FOLL_FORCE usage from drivers (reliable R/O long-term pinning)

2022-11-17 Thread David Hildenbrand
For now, we did not support reliable R/O long-term pinning in COW mappings. That means, if we would trigger R/O long-term pinning in MAP_PRIVATE mapping, we could end up pinning the (R/O-mapped) shared zeropage or a pagecache page. The next write access would trigger a write fault and replace the

[PATCH mm-unstable v1 20/20] mm: rename FOLL_FORCE to FOLL_PTRACE

2022-11-17 Thread David Hildenbrand
Let's make it clearer that functionality provided by FOLL_FORCE is really only for ptrace access. Prevent accidental re-use in drivers by renaming FOLL_FORCE to FOLL_PTRACE: git grep -l 'FOLL_FORCE' | xargs sed -i 's/FOLL_FORCE/FOLL_PTRACE/g' In the future, we might want to use a separate set

Re: [PATCH v2 12/44] cpuidle,dt: Push RCU-idle into driver

2022-11-17 Thread Peter Zijlstra
Sorry; things keep getting in the way of finishing this :/ As such, I need a bit of time to get on-track again.. On Tue, Oct 04, 2022 at 01:03:57PM +0200, Ulf Hansson wrote: > > --- a/drivers/acpi/processor_idle.c > > +++ b/drivers/acpi/processor_idle.c > > @@ -1200,6 +1200,8 @@ static int

Re: [PATCH mm-unstable v1 20/20] mm: rename FOLL_FORCE to FOLL_PTRACE

2022-11-17 Thread Linus Torvalds
On Wed, Nov 16, 2022 at 2:30 AM David Hildenbrand wrote: > > Let's make it clearer that functionality provided by FOLL_FORCE is > really only for ptrace access. I'm not super-happy about this one. I do understand the "let's rename the bit so that no new user shows up". And it's true that the

Re: [PATCH mm-unstable v1 20/20] mm: rename FOLL_FORCE to FOLL_PTRACE

2022-11-17 Thread David Hildenbrand
On 16.11.22 19:16, Linus Torvalds wrote: On Wed, Nov 16, 2022 at 2:30 AM David Hildenbrand wrote: Let's make it clearer that functionality provided by FOLL_FORCE is really only for ptrace access. I'm not super-happy about this one. I do understand the "let's rename the bit so that no new

Re: [PATCH v2 3/3] treewide: use get_random_u32_between() when possible

2022-11-17 Thread Kees Cook
On November 16, 2022 4:43:54 PM PST, "Jason A. Donenfeld" wrote: >On Wed, Nov 16, 2022 at 04:31:18PM -0800, Kees Cook wrote: >> On Thu, Nov 17, 2022 at 01:03:14AM +0100, Jason A. Donenfeld wrote: >> > On Thu, Nov 17, 2022 at 12:55:47AM +0100, Jason A. Donenfeld wrote: >> > > 2) What to call it:

[PATCH v7 2/2] arm64: support batched/deferred tlb shootdown during page reclamation

2022-11-17 Thread Yicong Yang
From: Barry Song on x86, batched and deferred tlb shootdown has lead to 90% performance increase on tlb shootdown. on arm64, HW can do tlb shootdown without software IPI. But sync tlbi is still quite expensive. Even running a simplest program which requires swapout can prove this is true,

[PATCH v7 1/2] mm/tlbbatch: Introduce arch_tlbbatch_should_defer()

2022-11-17 Thread Yicong Yang
From: Anshuman Khandual The entire scheme of deferred TLB flush in reclaim path rests on the fact that the cost to refill TLB entries is less than flushing out individual entries by sending IPI to remote CPUs. But architecture can have different ways to evaluate that. Hence apart from checking

Re: [RFC PATCH v2 5/8] irq_work: Trace self-IPIs sent via arch_irq_work_raise()

2022-11-17 Thread Peter Zijlstra
On Wed, Nov 02, 2022 at 06:33:33PM +, Valentin Schneider wrote: > IPIs sent to remove CPUs via irq_work_queue_on() are now covered by > trace_ipi_send_cpumask(), add another instance of the tracepoint to cover > self-IPIs. > > Signed-off-by: Valentin Schneider > --- > kernel/irq_work.c | 14

Re: [PATCH net-next v2 00/11] net: pcs: Add support for devices probed in the "usual" manner

2022-11-17 Thread Rob Herring
On Mon, Nov 14, 2022 at 1:53 PM Vladimir Oltean wrote: > > On Mon, Nov 14, 2022 at 01:08:03PM -0500, Sean Anderson wrote: > > On 11/14/22 12:23, Vladimir Oltean wrote: > > > On Thu, Nov 10, 2022 at 11:56:15AM -0500, Sean Anderson wrote: > > >> these will probably be in device trees for a year

Re: [RFC PATCH v2 8/8] sched, smp: Trace smp callback causing an IPI

2022-11-17 Thread Peter Zijlstra
On Wed, Nov 02, 2022 at 06:33:36PM +, Valentin Schneider wrote: > The newly-introduced ipi_send_cpumask tracepoint has a "callback" parameter > which so far has only been fed with NULL. > > While CSD_TYPE_SYNC/ASYNC and CSD_TYPE_IRQ_WORK share a similar backing > struct layout (meaning their

Re: [RFC PATCH v2 6/8] treewide: Trace IPIs sent via smp_send_reschedule()

2022-11-17 Thread Valentin Schneider
On 17/11/22 10:12, Peter Zijlstra wrote: > On Wed, Nov 02, 2022 at 06:33:34PM +, Valentin Schneider wrote: > >> diff --git a/kernel/smp.c b/kernel/smp.c >> index c4d561cf50d45..44fa4b9b1f46b 100644 >> --- a/kernel/smp.c >> +++ b/kernel/smp.c >> @@ -167,6 +167,14 @@

Re: [RFC PATCH v2 4/8] smp: Trace IPIs sent via arch_send_call_function_ipi_mask()

2022-11-17 Thread Valentin Schneider
On 17/11/22 10:08, Peter Zijlstra wrote: > On Wed, Nov 02, 2022 at 06:33:32PM +, Valentin Schneider wrote: >> This simply wraps around the arch function and prepends it with a >> tracepoint, similar to send_call_function_single_ipi(). >> >> Signed-off-by: Valentin Schneider >> --- >>

Re: [PATCH v2 3/3] treewide: use get_random_u32_between() when possible

2022-11-17 Thread Theodore Ts'o
On Wed, Nov 16, 2022 at 04:47:27PM -0800, Kees Cook wrote: > >> > - between > >> > - ranged > >> > - spanning > >> > > >> > https://www.thefreedictionary.com/List-of-prepositions.htm > >> > - amid > >> > > >> > Sigh, names. > >> > >> I think "inclusive" is best. > > > >I find it not very

Re: [patch 01/39] PCI/MSI: Check for MSI enabled in __pci_msix_enable()

2022-11-17 Thread Thomas Gleixner
On Wed, Nov 16 2022 at 07:39, Ashok Raj wrote: > On Fri, Nov 11, 2022 at 02:54:15PM +0100, Thomas Gleixner wrote: > > Can the pre-enabled checks for msi and msix be moved up before any vector > range check? > > not that it matters for how it fails, does EBUSY sound better? Does any caller care

Re: [patch 01/39] PCI/MSI: Check for MSI enabled in __pci_msix_enable()

2022-11-17 Thread Ashok Raj
On Thu, Nov 17, 2022 at 02:07:33PM +0100, Thomas Gleixner wrote: > On Wed, Nov 16 2022 at 07:39, Ashok Raj wrote: > > On Fri, Nov 11, 2022 at 02:54:15PM +0100, Thomas Gleixner wrote: > > > > Can the pre-enabled checks for msi and msix be moved up before any vector > > range check? > > > > not that

Re: [patch 39/39] x86/apic: Remove X86_IRQ_ALLOC_CONTIGUOUS_VECTORS

2022-11-17 Thread Thomas Gleixner
Jason, Bjorn, Ashok! On Wed, Nov 16 2022 at 14:05, Jason Gunthorpe wrote: > On Fri, Nov 11, 2022 at 02:55:17PM +0100, Thomas Gleixner wrote: >> Now that the PCI/MSI core code does early checking for multi-MSI support >> X86_IRQ_ALLOC_CONTIGUOUS_VECTORS is not required anymore. > >> Remove the

Re: [RFC PATCH v2 8/8] sched, smp: Trace smp callback causing an IPI

2022-11-17 Thread Valentin Schneider
On 17/11/22 15:12, Peter Zijlstra wrote: > On Wed, Nov 02, 2022 at 06:33:36PM +, Valentin Schneider wrote: > *yuck* :-) > > How about something like so? > > --- > --- a/kernel/irq_work.c > +++ b/kernel/irq_work.c > @@ -24,6 +24,8 @@ > > #include > > +#include "sched/smp.h" > + > static

Re: [PATCH 38/44] KVM: Disable CPU hotplug during hardware enabling

2022-11-17 Thread Sean Christopherson
On Thu, Nov 17, 2022, Huang, Kai wrote: > On Wed, 2022-11-16 at 17:11 +, Sean Christopherson wrote: > > static int kvm_x86_check_processor_compatibility(void) > > { > > int cpu = smp_processor_id(); > > struct cpuinfo_x86 *c = _data(cpu); > > > > /* > > *

Re: [PATCH v2 3/3] treewide: use get_random_u32_between() when possible

2022-11-17 Thread Jason A. Donenfeld
On Thu, Nov 17, 2022 at 10:42:37AM -0500, Theodore Ts'o wrote: > On Wed, Nov 16, 2022 at 04:47:27PM -0800, Kees Cook wrote: > > >> > - between > > >> > - ranged > > >> > - spanning > > >> > > > >> > https://www.thefreedictionary.com/List-of-prepositions.htm > > >> > - amid > > >> > > > >> >

[PATCH v3 1/3] treewide: use get_random_u32_below() instead of deprecated function

2022-11-17 Thread Jason A. Donenfeld
This is a simple mechanical transformation done by: @@ expression E; @@ - prandom_u32_max + get_random_u32_below (E) Reviewed-by: Greg Kroah-Hartman Acked-by: Darrick J. Wong # for xfs Reviewed-by: SeongJae Park # for damon Reviewed-by: Jason Gunthorpe # for infiniband Reviewed-by: Russell

[PATCH v3 2/3] treewide: use get_random_u32_{above,below}() instead of manual loop

2022-11-17 Thread Jason A. Donenfeld
These cases were done with this Coccinelle: @@ expression E; identifier I; @@ - do { ... when != I - I = get_random_u32(); ... when != I - } while (I > E); + I = get_random_u32_below(E + 1); @@ expression E; identifier I; @@ - do { ... when != I - I =

[PATCH v3 0/3] convert tree to get_random_u32_{below,above,inclusive}()

2022-11-17 Thread Jason A. Donenfeld
Hey everyone, [Changes v2->v3: rename get_random_u32_between() to get_random_u32_inclusive(), and implement with closed interval.] This series is the second tranche of tree-wide conversions to get random integer handling a bit tamer. It's another Coccinelle-based patchset. First we

[PATCH v3 3/3] treewide: use get_random_u32_inclusive() when possible

2022-11-17 Thread Jason A. Donenfeld
These cases were done with this Coccinelle: @@ expression H; expression L; @@ - (get_random_u32_below(H) + L) + get_random_u32_inclusive(L, H + L - 1) @@ expression H; expression L; expression E; @@ get_random_u32_inclusive(L, H - + E - - E ) @@ expression H; expression L; expression E;

Re: [PATCH 2/4] fs: define a firmware security filesystem named fwsecurityfs

2022-11-17 Thread Greg Kroah-Hartman
On Mon, Nov 14, 2022 at 06:03:43PM -0500, Nayna wrote: > > On 11/10/22 04:58, Greg Kroah-Hartman wrote: > > On Wed, Nov 09, 2022 at 03:10:37PM -0500, Nayna wrote: > > > On 11/9/22 08:46, Greg Kroah-Hartman wrote: > > > > On Sun, Nov 06, 2022 at 04:07:42PM -0500, Nayna Jain wrote: > > > > >

Re: [PATCH v3 1/3] treewide: use get_random_u32_below() instead of deprecated function

2022-11-17 Thread Kees Cook
On Thu, Nov 17, 2022 at 09:29:04PM +0100, Jason A. Donenfeld wrote: > This is a simple mechanical transformation done by: > > @@ > expression E; > @@ > - prandom_u32_max > + get_random_u32_below > (E) > > Reviewed-by: Greg Kroah-Hartman > Acked-by: Darrick J. Wong # for xfs > Reviewed-by:

Re: [PATCH v3 3/3] treewide: use get_random_u32_inclusive() when possible

2022-11-17 Thread Jason A. Donenfeld
On Thu, Nov 17, 2022 at 01:57:13PM -0800, Kees Cook wrote: > The only comment I have is that maybe these cases can just be left as-is > with _below()? > > > - size_t len = get_random_u32_below(rs) + gs; > > + size_t len = get_random_u32_inclusive(gs, rs + gs - 1); > > It

RE: [PATCH v2 3/3] treewide: use get_random_u32_between() when possible

2022-11-17 Thread David Laight
From: Theodore Ts'o > Sent: 17 November 2022 15:43 ... > The problem with "between", "ranged", "spanning" is that they don't > tell the reader whether we're dealing with an "open interval" or a > "closed interval". They are just different ways of saying that it's a > range between, say, 0 and 20.

Re: [PATCH v3 3/3] treewide: use get_random_u32_inclusive() when possible

2022-11-17 Thread Kees Cook
On Thu, Nov 17, 2022 at 09:29:06PM +0100, Jason A. Donenfeld wrote: > These cases were done with this Coccinelle: > > @@ > expression H; > expression L; > @@ > - (get_random_u32_below(H) + L) > + get_random_u32_inclusive(L, H + L - 1) > > @@ > expression H; > expression L; > expression E; > @@ >

Re: [PATCH v3 2/3] treewide: use get_random_u32_{above,below}() instead of manual loop

2022-11-17 Thread Kees Cook
On Thu, Nov 17, 2022 at 09:29:05PM +0100, Jason A. Donenfeld wrote: > These cases were done with this Coccinelle: > > @@ > expression E; > identifier I; > @@ > - do { > ... when != I > - I = get_random_u32(); > ... when != I > - } while (I > E); > + I =

Re: [PATCH v6] livepatch: Clear relocation targets on a module removal

2022-11-17 Thread Song Liu
Hi folks, It seems we forgot about this work... What shall we do to move forward? Thanks, Song On Thu, Sep 1, 2022 at 10:16 AM Song Liu wrote: > > From: Miroslav Benes > > Josh reported a bug: > > When the object to be patched is a module, and that module is > rmmod'ed and reloaded, it