···5959James Bottomley <jejb@titanic.il.steeleye.com>6060James E Wilson <wilson@specifix.com>6161James Ketrenos <jketreno@io.(none)>6262+<javier@osg.samsung.com> <javier.martinez@collabora.co.uk>6263Jean Tourrilhes <jt@hpl.hp.com>6364Jeff Garzik <jgarzik@pretzel.yyz.us>6465Jens Axboe <axboe@suse.de>
+7
Documentation/arm/OMAP/README
···11+This file contains documentation for running mainline22+kernel on omaps.33+44+KERNEL NEW DEPENDENCIES55+v4.3+ Update is needed for custom .config files to make sure66+ CONFIG_REGULATOR_PBIAS is enabled for MMC1 to work77+ properly.
···559559560560void __init pdata_quirks_init(const struct of_device_id *omap_dt_match_table)561561{562562- omap_sdrc_init(NULL, NULL);562562+ /*563563+ * We still need this for omap2420 and omap3 PM to work, others are564564+ * using drivers/misc/sram.c already.565565+ */566566+ if (of_machine_is_compatible("ti,omap2420") ||567567+ of_machine_is_compatible("ti,omap3"))568568+ omap_sdrc_init(NULL, NULL);569569+563570 pdata_quirks_check(auxdata_quirks);564571 of_platform_populate(NULL, omap_dt_match_table,565572 omap_auxdata_lookup, NULL);
···2525 unsigned long kernel_size, kernel_memsize = 0;2626 unsigned long nr_pages;2727 void *old_image_addr = (void *)*image_addr;2828+ unsigned long preferred_offset;2929+3030+ /*3131+ * The preferred offset of the kernel Image is TEXT_OFFSET bytes beyond3232+ * a 2 MB aligned base, which itself may be lower than dram_base, as3333+ * long as the resulting offset equals or exceeds it.3434+ */3535+ preferred_offset = round_down(dram_base, SZ_2M) + TEXT_OFFSET;3636+ if (preferred_offset < dram_base)3737+ preferred_offset += SZ_2M;28382939 /* Relocate the image, if required. */3040 kernel_size = _edata - _text;3131- if (*image_addr != (dram_base + TEXT_OFFSET)) {4141+ if (*image_addr != preferred_offset) {3242 kernel_memsize = kernel_size + (_end - _edata);33433444 /*···5242 * Mustang), we can still place the kernel at the address5343 * 'dram_base + TEXT_OFFSET'.5444 */5555- *image_addr = *reserve_addr = dram_base + TEXT_OFFSET;4545+ *image_addr = *reserve_addr = preferred_offset;5646 nr_pages = round_up(kernel_memsize, EFI_ALLOC_ALIGN) /5747 EFI_PAGE_SIZE;5848 status = efi_call_early(allocate_pages, EFI_ALLOCATE_ADDRESS,
+1-5
arch/arm64/kernel/stacktrace.c
···48484949 frame->sp = fp + 0x10;5050 frame->fp = *(unsigned long *)(fp);5151- /*5252- * -4 here because we care about the PC at time of bl,5353- * not where the return will go.5454- */5555- frame->pc = *(unsigned long *)(fp + 8) - 4;5151+ frame->pc = *(unsigned long *)(fp + 8);56525753 return 0;5854}
+13-9
arch/arm64/kernel/suspend.c
···8080 if (ret == 0) {8181 /*8282 * We are resuming from reset with TTBR0_EL1 set to the8383- * idmap to enable the MMU; restore the active_mm mappings in8484- * TTBR0_EL1 unless the active_mm == &init_mm, in which case8585- * the thread entered cpu_suspend with TTBR0_EL1 set to8686- * reserved TTBR0 page tables and should be restored as such.8383+ * idmap to enable the MMU; set the TTBR0 to the reserved8484+ * page tables to prevent speculative TLB allocations, flush8585+ * the local tlb and set the default tcr_el1.t0sz so that8686+ * the TTBR0 address space set-up is properly restored.8787+ * If the current active_mm != &init_mm we entered cpu_suspend8888+ * with mappings in TTBR0 that must be restored, so we switch8989+ * them back to complete the address space configuration9090+ * restoration before returning.8791 */8888- if (mm == &init_mm)8989- cpu_set_reserved_ttbr0();9090- else9191- cpu_switch_mm(mm->pgd, mm);9292-9292+ cpu_set_reserved_ttbr0();9393 flush_tlb_all();9494+ cpu_set_default_tcr_t0sz();9595+9696+ if (mm != &init_mm)9797+ cpu_switch_mm(mm->pgd, mm);94989599 /*96100 * Restore per-cpu offset before any kernel
+1-1
arch/ia64/include/asm/unistd.h
···1111121213131414-#define NR_syscalls 321 /* length of syscall table */1414+#define NR_syscalls 322 /* length of syscall table */15151616/*1717 * The following defines stop scripts/checksyscalls.sh from complaining about
···36363737#include <asm/reg.h>3838#include <asm/cputable.h>3939-#include <asm/cache.h>4039#include <asm/cacheflush.h>4140#include <asm/tlbflush.h>4241#include <asm/uaccess.h>···7374#define TB_NIL (~(u64)0)74757576static DECLARE_BITMAP(default_enabled_hcalls, MAX_HCALL_OPCODE/4 + 1);7676-7777-#if defined(CONFIG_PPC_64K_PAGES)7878-#define MPP_BUFFER_ORDER 07979-#elif defined(CONFIG_PPC_4K_PAGES)8080-#define MPP_BUFFER_ORDER 38181-#endif82778378static int dynamic_mt_modes = 6;8479module_param(dynamic_mt_modes, int, S_IRUGO | S_IWUSR);···14481455 vcore->kvm = kvm;14491456 INIT_LIST_HEAD(&vcore->preempt_list);1450145714511451- vcore->mpp_buffer_is_valid = false;14521452-14531453- if (cpu_has_feature(CPU_FTR_ARCH_207S))14541454- vcore->mpp_buffer = (void *)__get_free_pages(14551455- GFP_KERNEL|__GFP_ZERO,14561456- MPP_BUFFER_ORDER);14571457-14581458 return vcore;14591459}14601460···18781892 }18791893 }18801894 return 1;18811881-}18821882-18831883-static void kvmppc_start_saving_l2_cache(struct kvmppc_vcore *vc)18841884-{18851885- phys_addr_t phy_addr, mpp_addr;18861886-18871887- phy_addr = (phys_addr_t)virt_to_phys(vc->mpp_buffer);18881888- mpp_addr = phy_addr & PPC_MPPE_ADDRESS_MASK;18891889-18901890- mtspr(SPRN_MPPR, mpp_addr | PPC_MPPR_FETCH_ABORT);18911891- logmpp(mpp_addr | PPC_LOGMPP_LOG_L2);18921892-18931893- vc->mpp_buffer_is_valid = true;18941894-}18951895-18961896-static void kvmppc_start_restoring_l2_cache(const struct kvmppc_vcore *vc)18971897-{18981898- phys_addr_t phy_addr, mpp_addr;18991899-19001900- phy_addr = virt_to_phys(vc->mpp_buffer);19011901- mpp_addr = phy_addr & PPC_MPPE_ADDRESS_MASK;19021902-19031903- /* We must abort any in-progress save operations to ensure19041904- * the table is valid so that prefetch engine knows when to19051905- * stop prefetching. */19061906- logmpp(mpp_addr | PPC_LOGMPP_LOG_ABORT);19071907- mtspr(SPRN_MPPR, mpp_addr | PPC_MPPR_FETCH_WHOLE_TABLE);19081895}1909189619101897/*···2430247124312472 srcu_idx = srcu_read_lock(&vc->kvm->srcu);2432247324332433- if (vc->mpp_buffer_is_valid)24342434- kvmppc_start_restoring_l2_cache(vc);24352435-24362474 __kvmppc_vcore_entry();24372437-24382438- if (vc->mpp_buffer)24392439- kvmppc_start_saving_l2_cache(vc);2440247524412476 srcu_read_unlock(&vc->kvm->srcu, srcu_idx);24422477···30263073{30273074 long int i;3028307530293029- for (i = 0; i < KVM_MAX_VCORES; ++i) {30303030- if (kvm->arch.vcores[i] && kvm->arch.vcores[i]->mpp_buffer) {30313031- struct kvmppc_vcore *vc = kvm->arch.vcores[i];30323032- free_pages((unsigned long)vc->mpp_buffer,30333033- MPP_BUFFER_ORDER);30343034- }30763076+ for (i = 0; i < KVM_MAX_VCORES; ++i)30353077 kfree(kvm->arch.vcores[i]);30363036- }30373078 kvm->arch.online_vcores = 0;30383079}30393080
+24-5
arch/powerpc/platforms/powernv/smp.c
···171171 * so clear LPCR:PECE1. We keep PECE2 enabled.172172 */173173 mtspr(SPRN_LPCR, mfspr(SPRN_LPCR) & ~(u64)LPCR_PECE1);174174+175175+ /*176176+ * Hard-disable interrupts, and then clear irq_happened flags177177+ * that we can safely ignore while off-line, since they178178+ * are for things for which we do no processing when off-line179179+ * (or in the case of HMI, all the processing we need to do180180+ * is done in lower-level real-mode code).181181+ */182182+ hard_irq_disable();183183+ local_paca->irq_happened &= ~(PACA_IRQ_DEC | PACA_IRQ_HMI);184184+174185 while (!generic_check_cpu_restart(cpu)) {186186+ /*187187+ * Clear IPI flag, since we don't handle IPIs while188188+ * offline, except for those when changing micro-threading189189+ * mode, which are handled explicitly below, and those190190+ * for coming online, which are handled via191191+ * generic_check_cpu_restart() calls.192192+ */193193+ kvmppc_set_host_ipi(cpu, 0);175194176195 ppc64_runlatch_off();177196···215196 * having finished executing in a KVM guest, then srr1216197 * contains 0.217198 */218218- if ((srr1 & wmask) == SRR1_WAKEEE) {199199+ if (((srr1 & wmask) == SRR1_WAKEEE) ||200200+ (local_paca->irq_happened & PACA_IRQ_EE)) {219201 icp_native_flush_interrupt();220220- local_paca->irq_happened &= PACA_IRQ_HARD_DIS;221221- smp_mb();222202 } else if ((srr1 & wmask) == SRR1_WAKEHDBELL) {223203 unsigned long msg = PPC_DBELL_TYPE(PPC_DBELL_SERVER);224204 asm volatile(PPC_MSGCLR(%0) : : "r" (msg));225225- kvmppc_set_host_ipi(cpu, 0);226205 }206206+ local_paca->irq_happened &= ~(PACA_IRQ_EE | PACA_IRQ_DBELL);207207+ smp_mb();227208228209 if (cpu_core_split_required())229210 continue;230211231231- if (!generic_check_cpu_restart(cpu))212212+ if (srr1 && !generic_check_cpu_restart(cpu))232213 DBG("CPU%d Unexpected exit while offline !\n", cpu);233214 }234215 mtspr(SPRN_LPCR, mfspr(SPRN_LPCR) | LPCR_PECE1);
+2-2
arch/um/Makefile
···70707171USER_CFLAGS = $(patsubst $(KERNEL_DEFINES),,$(patsubst -I%,,$(KBUILD_CFLAGS))) \7272 $(ARCH_INCLUDE) $(MODE_INCLUDE) $(filter -I%,$(CFLAGS)) \7373- -D_FILE_OFFSET_BITS=64 -idirafter include \7474- -D__KERNEL__ -D__UM_HOST__7373+ -D_FILE_OFFSET_BITS=64 -idirafter $(srctree)/include \7474+ -idirafter $(obj)/include -D__KERNEL__ -D__UM_HOST__75757676#This will adjust *FLAGS accordingly to the platform.7777include $(ARCH_DIR)/Makefile-os-$(OS)
+1-1
arch/um/kernel/trap.c
···220220 show_regs(container_of(regs, struct pt_regs, regs));221221 panic("Segfault with no mm");222222 }223223- else if (!is_user && address < TASK_SIZE) {223223+ else if (!is_user && address > PAGE_SIZE && address < TASK_SIZE) {224224 show_regs(container_of(regs, struct pt_regs, regs));225225 panic("Kernel tried to access user memory at addr 0x%lx, ip 0x%lx",226226 address, ip);
···550550 if (sp < bottom || sp > top)551551 return 0;552552553553- fp = READ_ONCE(*(unsigned long *)sp);553553+ fp = READ_ONCE_NOCHECK(*(unsigned long *)sp);554554 do {555555 if (fp < bottom || fp > top)556556 return 0;557557- ip = READ_ONCE(*(unsigned long *)(fp + sizeof(unsigned long)));557557+ ip = READ_ONCE_NOCHECK(*(unsigned long *)(fp + sizeof(unsigned long)));558558 if (!in_sched_functions(ip))559559 return ip;560560- fp = READ_ONCE(*(unsigned long *)fp);560560+ fp = READ_ONCE_NOCHECK(*(unsigned long *)fp);561561 } while (count++ < 16 && p->state != TASK_RUNNING);562562 return 0;563563}
+8
arch/x86/kernel/setup.c
···11731173 clone_pgd_range(initial_page_table + KERNEL_PGD_BOUNDARY,11741174 swapper_pg_dir + KERNEL_PGD_BOUNDARY,11751175 KERNEL_PGD_PTRS);11761176+11771177+ /*11781178+ * sync back low identity map too. It is used for example11791179+ * in the 32-bit EFI stub.11801180+ */11811181+ clone_pgd_range(initial_page_table,11821182+ swapper_pg_dir + KERNEL_PGD_BOUNDARY,11831183+ KERNEL_PGD_PTRS);11761184#endif1177118511781186 tboot_probe();
+11-4
arch/x86/kernel/smpboot.c
···509509 */510510#define UDELAY_10MS_DEFAULT 10000511511512512-static unsigned int init_udelay = UDELAY_10MS_DEFAULT;512512+static unsigned int init_udelay = INT_MAX;513513514514static int __init cpu_init_udelay(char *str)515515{···522522static void __init smp_quirk_init_udelay(void)523523{524524 /* if cmdline changed it from default, leave it alone */525525- if (init_udelay != UDELAY_10MS_DEFAULT)525525+ if (init_udelay != INT_MAX)526526 return;527527528528 /* if modern processor, use no delay */529529 if (((boot_cpu_data.x86_vendor == X86_VENDOR_INTEL) && (boot_cpu_data.x86 == 6)) ||530530 ((boot_cpu_data.x86_vendor == X86_VENDOR_AMD) && (boot_cpu_data.x86 >= 0xF)))531531 init_udelay = 0;532532+533533+ /* else, use legacy delay */534534+ init_udelay = UDELAY_10MS_DEFAULT;532535}533536534537/*···660657 /*661658 * Give the other CPU some time to accept the IPI.662659 */663663- if (init_udelay)660660+ if (init_udelay == 0)661661+ udelay(10);662662+ else664663 udelay(300);665664666665 pr_debug("Startup point 1\n");···673668 /*674669 * Give the other CPU some time to accept the IPI.675670 */676676- if (init_udelay)671671+ if (init_udelay == 0)672672+ udelay(10);673673+ else677674 udelay(200);678675679676 if (maxlvt > 3) /* Due to the Pentium erratum 3AP. */
+4-1
arch/x86/um/ldt.c
···1212#include <skas.h>1313#include <sysdep/tls.h>14141515-extern int modify_ldt(int func, void *ptr, unsigned long bytecount);1515+static inline int modify_ldt (int func, void *ptr, unsigned long bytecount)1616+{1717+ return syscall(__NR_modify_ldt, func, ptr, bytecount);1818+}16191720static long write_ldt_entry(struct mm_id *mm_idp, int func,1821 struct user_desc *desc, void **addr, int done)
+1-1
block/blk-core.c
···576576 q->queue_lock = &q->__queue_lock;577577 spin_unlock_irq(lock);578578579579- bdi_destroy(&q->backing_dev_info);579579+ bdi_unregister(&q->backing_dev_info);580580581581 /* @q is and will stay empty, shutdown and put */582582 blk_put_queue(q);
+22-9
block/blk-lib.c
···2626 bio_put(bio);2727}28282929-/*3030- * Ensure that max discard sectors doesn't overflow bi_size and hopefully3131- * it is of the proper granularity as long as the granularity is a power3232- * of two.3333- */3434-#define MAX_BIO_SECTORS ((1U << 31) >> 9)3535-3629/**3730 * blkdev_issue_discard - queue a discard3831 * @bdev: blockdev to issue discard for···4350 DECLARE_COMPLETION_ONSTACK(wait);4451 struct request_queue *q = bdev_get_queue(bdev);4552 int type = REQ_WRITE | REQ_DISCARD;5353+ unsigned int granularity;5454+ int alignment;4655 struct bio_batch bb;4756 struct bio *bio;4857 int ret = 0;···55605661 if (!blk_queue_discard(q))5762 return -EOPNOTSUPP;6363+6464+ /* Zero-sector (unknown) and one-sector granularities are the same. */6565+ granularity = max(q->limits.discard_granularity >> 9, 1U);6666+ alignment = (bdev_discard_alignment(bdev) >> 9) % granularity;58675968 if (flags & BLKDEV_DISCARD_SECURE) {6069 if (!blk_queue_secdiscard(q))···7374 blk_start_plug(&plug);7475 while (nr_sects) {7576 unsigned int req_sects;7676- sector_t end_sect;7777+ sector_t end_sect, tmp;77787879 bio = bio_alloc(gfp_mask, 1);7980 if (!bio) {···8182 break;8283 }83848484- req_sects = min_t(sector_t, nr_sects, MAX_BIO_SECTORS);8585+ /* Make sure bi_size doesn't overflow */8686+ req_sects = min_t(sector_t, nr_sects, UINT_MAX >> 9);8787+8888+ /*8989+ * If splitting a request, and the next starting sector would be9090+ * misaligned, stop the discard at the previous aligned sector.9191+ */8592 end_sect = sector + req_sects;9393+ tmp = end_sect;9494+ if (req_sects < nr_sects &&9595+ sector_div(tmp, granularity) != alignment) {9696+ end_sect = end_sect - alignment;9797+ sector_div(end_sect, granularity);9898+ end_sect = end_sect * granularity + alignment;9999+ req_sects = end_sect - sector;100100+ }8610187102 bio->bi_iter.bi_sector = sector;88103 bio->bi_end_io = bio_batch_end_io;
···172172 struct crypto_larval *larval = (void *)alg;173173 long timeout;174174175175- timeout = wait_for_completion_interruptible_timeout(175175+ timeout = wait_for_completion_killable_timeout(176176 &larval->completion, 60 * HZ);177177178178 alg = larval->adult;···445445err:446446 if (err != -EAGAIN)447447 break;448448- if (signal_pending(current)) {448448+ if (fatal_signal_pending(current)) {449449 err = -EINTR;450450 break;451451 }···562562err:563563 if (err != -EAGAIN)564564 break;565565- if (signal_pending(current)) {565565+ if (fatal_signal_pending(current)) {566566 err = -EINTR;567567 break;568568 }
+1-1
crypto/crypto_user.c
···375375 err = PTR_ERR(alg);376376 if (err != -EAGAIN)377377 break;378378- if (signal_pending(current)) {378378+ if (fatal_signal_pending(current)) {379379 err = -EINTR;380380 break;381381 }
+1-1
drivers/base/dma-contiguous.c
···187187 * global one. Requires architecture specific dev_get_cma_area() helper188188 * function.189189 */190190-struct page *dma_alloc_from_contiguous(struct device *dev, int count,190190+struct page *dma_alloc_from_contiguous(struct device *dev, size_t count,191191 unsigned int align)192192{193193 if (align > CONFIG_CMA_ALIGNMENT)
+30-6
drivers/block/nbd.c
···6060 bool disconnect; /* a disconnect has been requested by user */61616262 struct timer_list timeout_timer;6363+ spinlock_t tasks_lock;6364 struct task_struct *task_recv;6465 struct task_struct *task_send;6566···141140static void nbd_xmit_timeout(unsigned long arg)142141{143142 struct nbd_device *nbd = (struct nbd_device *)arg;144144- struct task_struct *task;143143+ unsigned long flags;145144146145 if (list_empty(&nbd->queue_head))147146 return;148147149148 nbd->disconnect = true;150149151151- task = READ_ONCE(nbd->task_recv);152152- if (task)153153- force_sig(SIGKILL, task);150150+ spin_lock_irqsave(&nbd->tasks_lock, flags);154151155155- task = READ_ONCE(nbd->task_send);156156- if (task)152152+ if (nbd->task_recv)153153+ force_sig(SIGKILL, nbd->task_recv);154154+155155+ if (nbd->task_send)157156 force_sig(SIGKILL, nbd->task_send);157157+158158+ spin_unlock_irqrestore(&nbd->tasks_lock, flags);158159159160 dev_err(nbd_to_dev(nbd), "Connection timed out, killed receiver and sender, shutting down connection\n");160161}···406403{407404 struct request *req;408405 int ret;406406+ unsigned long flags;409407410408 BUG_ON(nbd->magic != NBD_MAGIC);411409412410 sk_set_memalloc(nbd->sock->sk);413411412412+ spin_lock_irqsave(&nbd->tasks_lock, flags);414413 nbd->task_recv = current;414414+ spin_unlock_irqrestore(&nbd->tasks_lock, flags);415415416416 ret = device_create_file(disk_to_dev(nbd->disk), &pid_attr);417417 if (ret) {418418 dev_err(disk_to_dev(nbd->disk), "device_create_file failed!\n");419419+420420+ spin_lock_irqsave(&nbd->tasks_lock, flags);419421 nbd->task_recv = NULL;422422+ spin_unlock_irqrestore(&nbd->tasks_lock, flags);423423+420424 return ret;421425 }422426···439429440430 device_remove_file(disk_to_dev(nbd->disk), &pid_attr);441431432432+ spin_lock_irqsave(&nbd->tasks_lock, flags);442433 nbd->task_recv = NULL;434434+ spin_unlock_irqrestore(&nbd->tasks_lock, flags);443435444436 if (signal_pending(current)) {445437 siginfo_t info;···546534{547535 struct nbd_device *nbd = data;548536 struct request *req;537537+ unsigned long flags;549538539539+ spin_lock_irqsave(&nbd->tasks_lock, flags);550540 nbd->task_send = current;541541+ spin_unlock_irqrestore(&nbd->tasks_lock, flags);551542552543 set_user_nice(current, MIN_NICE);553544 while (!kthread_should_stop() || !list_empty(&nbd->waiting_queue)) {···587572 nbd_handle_req(nbd, req);588573 }589574575575+ spin_lock_irqsave(&nbd->tasks_lock, flags);590576 nbd->task_send = NULL;577577+ spin_unlock_irqrestore(&nbd->tasks_lock, flags);578578+579579+ /* Clear maybe pending signals */580580+ if (signal_pending(current)) {581581+ siginfo_t info;582582+ dequeue_signal_lock(current, ¤t->blocked, &info);583583+ }591584592585 return 0;593586}···10751052 nbd_dev[i].magic = NBD_MAGIC;10761053 INIT_LIST_HEAD(&nbd_dev[i].waiting_queue);10771054 spin_lock_init(&nbd_dev[i].queue_lock);10551055+ spin_lock_init(&nbd_dev[i].tasks_lock);10781056 INIT_LIST_HEAD(&nbd_dev[i].queue_head);10791057 mutex_init(&nbd_dev[i].tx_lock);10801058 init_timer(&nbd_dev[i].timeout_timer);
+15-9
drivers/block/nvme-core.c
···603603 struct nvme_iod *iod = ctx;604604 struct request *req = iod_get_private(iod);605605 struct nvme_cmd_info *cmd_rq = blk_mq_rq_to_pdu(req);606606-607606 u16 status = le16_to_cpup(&cqe->status) >> 1;607607+ bool requeue = false;608608+ int error = 0;608609609610 if (unlikely(status)) {610611 if (!(status & NVME_SC_DNR || blk_noretry_request(req))611612 && (jiffies - req->start_time) < req->timeout) {612613 unsigned long flags;613614615615+ requeue = true;614616 blk_mq_requeue_request(req);615617 spin_lock_irqsave(req->q->queue_lock, flags);616618 if (!blk_queue_stopped(req->q))617619 blk_mq_kick_requeue_list(req->q);618620 spin_unlock_irqrestore(req->q->queue_lock, flags);619619- return;621621+ goto release_iod;620622 }621623622624 if (req->cmd_type == REQ_TYPE_DRV_PRIV) {623625 if (cmd_rq->ctx == CMD_CTX_CANCELLED)624624- status = -EINTR;626626+ error = -EINTR;627627+ else628628+ error = status;625629 } else {626626- status = nvme_error_status(status);630630+ error = nvme_error_status(status);627631 }628632 }629633···639635 if (cmd_rq->aborted)640636 dev_warn(nvmeq->dev->dev,641637 "completing aborted command with status:%04x\n",642642- status);638638+ error);643639640640+release_iod:644641 if (iod->nents) {645642 dma_unmap_sg(nvmeq->dev->dev, iod->sg, iod->nents,646643 rq_data_dir(req) ? DMA_TO_DEVICE : DMA_FROM_DEVICE);···654649 }655650 nvme_free_iod(nvmeq->dev, iod);656651657657- blk_mq_complete_request(req, status);652652+ if (likely(!requeue))653653+ blk_mq_complete_request(req, error);658654}659655660656/* length is in bytes. gfp flags indicates whether we may sleep. */···1810180418111805 length = (io.nblocks + 1) << ns->lba_shift;18121806 meta_len = (io.nblocks + 1) * ns->ms;18131813- metadata = (void __user *)(unsigned long)io.metadata;18071807+ metadata = (void __user *)(uintptr_t)io.metadata;18141808 write = io.opcode & 1;1815180918161810 if (ns->ext) {···18501844 c.rw.metadata = cpu_to_le64(meta_dma);1851184518521846 status = __nvme_submit_sync_cmd(ns->queue, &c, NULL,18531853- (void __user *)io.addr, length, NULL, 0);18471847+ (void __user *)(uintptr_t)io.addr, length, NULL, 0);18541848 unmap:18551849 if (meta) {18561850 if (status == NVME_SC_SUCCESS && !write) {···18921886 timeout = msecs_to_jiffies(cmd.timeout_ms);1893188718941888 status = __nvme_submit_sync_cmd(ns ? ns->queue : dev->admin_q, &c,18951895- NULL, (void __user *)cmd.addr, cmd.data_len,18891889+ NULL, (void __user *)(uintptr_t)cmd.addr, cmd.data_len,18961890 &cmd.result, timeout);18971891 if (status >= 0) {18981892 if (put_user(cmd.result, &ucmd->result))
+48-36
drivers/block/rbd.c
···9696#define RBD_MINORS_PER_MAJOR 2569797#define RBD_SINGLE_MAJOR_PART_SHIFT 498989999+#define RBD_MAX_PARENT_CHAIN_LEN 16100100+99101#define RBD_SNAP_DEV_NAME_PREFIX "snap_"100102#define RBD_MAX_SNAP_NAME_LEN \101103 (NAME_MAX - (sizeof (RBD_SNAP_DEV_NAME_PREFIX) - 1))···428426 size_t count);429427static ssize_t rbd_remove_single_major(struct bus_type *bus, const char *buf,430428 size_t count);431431-static int rbd_dev_image_probe(struct rbd_device *rbd_dev, bool mapping);429429+static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth);432430static void rbd_spec_put(struct rbd_spec *spec);433431434432static int rbd_dev_id_to_minor(int dev_id)···37803778 blk_queue_max_discard_sectors(q, segment_size / SECTOR_SIZE);37813779 q->limits.discard_zeroes_data = 1;3782378037813781+ if (!ceph_test_opt(rbd_dev->rbd_client->client, NOCRC))37823782+ q->backing_dev_info.capabilities |= BDI_CAP_STABLE_WRITES;37833783+37833784 disk->queue = q;3784378537853786 q->queuedata = rbd_dev;···51365131 return ret;51375132}5138513351395139-static int rbd_dev_probe_parent(struct rbd_device *rbd_dev)51345134+/*51355135+ * @depth is rbd_dev_image_probe() -> rbd_dev_probe_parent() ->51365136+ * rbd_dev_image_probe() recursion depth, which means it's also the51375137+ * length of the already discovered part of the parent chain.51385138+ */51395139+static int rbd_dev_probe_parent(struct rbd_device *rbd_dev, int depth)51405140{51415141 struct rbd_device *parent = NULL;51425142- struct rbd_spec *parent_spec;51435143- struct rbd_client *rbdc;51445142 int ret;5145514351465144 if (!rbd_dev->parent_spec)51475145 return 0;51485148- /*51495149- * We need to pass a reference to the client and the parent51505150- * spec when creating the parent rbd_dev. Images related by51515151- * parent/child relationships always share both.51525152- */51535153- parent_spec = rbd_spec_get(rbd_dev->parent_spec);51545154- rbdc = __rbd_get_client(rbd_dev->rbd_client);5155514651565156- ret = -ENOMEM;51575157- parent = rbd_dev_create(rbdc, parent_spec, NULL);51585158- if (!parent)51475147+ if (++depth > RBD_MAX_PARENT_CHAIN_LEN) {51485148+ pr_info("parent chain is too long (%d)\n", depth);51495149+ ret = -EINVAL;51595150 goto out_err;51605160-51615161- ret = rbd_dev_image_probe(parent, false);51625162- if (ret < 0)51635163- goto out_err;51645164- rbd_dev->parent = parent;51655165- atomic_set(&rbd_dev->parent_ref, 1);51665166-51675167- return 0;51685168-out_err:51695169- if (parent) {51705170- rbd_dev_unparent(rbd_dev);51715171- rbd_dev_destroy(parent);51725172- } else {51735173- rbd_put_client(rbdc);51745174- rbd_spec_put(parent_spec);51755151 }5176515251535153+ parent = rbd_dev_create(rbd_dev->rbd_client, rbd_dev->parent_spec,51545154+ NULL);51555155+ if (!parent) {51565156+ ret = -ENOMEM;51575157+ goto out_err;51585158+ }51595159+51605160+ /*51615161+ * Images related by parent/child relationships always share51625162+ * rbd_client and spec/parent_spec, so bump their refcounts.51635163+ */51645164+ __rbd_get_client(rbd_dev->rbd_client);51655165+ rbd_spec_get(rbd_dev->parent_spec);51665166+51675167+ ret = rbd_dev_image_probe(parent, depth);51685168+ if (ret < 0)51695169+ goto out_err;51705170+51715171+ rbd_dev->parent = parent;51725172+ atomic_set(&rbd_dev->parent_ref, 1);51735173+ return 0;51745174+51755175+out_err:51765176+ rbd_dev_unparent(rbd_dev);51775177+ if (parent)51785178+ rbd_dev_destroy(parent);51775179 return ret;51785180}51795181···52985286 * parent), initiate a watch on its header object before using that52995287 * object to get detailed information about the rbd image.53005288 */53015301-static int rbd_dev_image_probe(struct rbd_device *rbd_dev, bool mapping)52895289+static int rbd_dev_image_probe(struct rbd_device *rbd_dev, int depth)53025290{53035291 int ret;53045292···53165304 if (ret)53175305 goto err_out_format;5318530653195319- if (mapping) {53075307+ if (!depth) {53205308 ret = rbd_dev_header_watch_sync(rbd_dev);53215309 if (ret) {53225310 if (ret == -ENOENT)···53375325 * Otherwise this is a parent image, identified by pool, image53385326 * and snap ids - need to fill in names for those ids.53395327 */53405340- if (mapping)53285328+ if (!depth)53415329 ret = rbd_spec_fill_snap_id(rbd_dev);53425330 else53435331 ret = rbd_spec_fill_names(rbd_dev);···53595347 * Need to warn users if this image is the one being53605348 * mapped and has a parent.53615349 */53625362- if (mapping && rbd_dev->parent_spec)53505350+ if (!depth && rbd_dev->parent_spec)53635351 rbd_warn(rbd_dev,53645352 "WARNING: kernel layering is EXPERIMENTAL!");53655353 }5366535453675367- ret = rbd_dev_probe_parent(rbd_dev);53555355+ ret = rbd_dev_probe_parent(rbd_dev, depth);53685356 if (ret)53695357 goto err_out_probe;53705358···53755363err_out_probe:53765364 rbd_dev_unprobe(rbd_dev);53775365err_out_watch:53785378- if (mapping)53665366+ if (!depth)53795367 rbd_dev_header_unwatch_sync(rbd_dev);53805368out_header_name:53815369 kfree(rbd_dev->header_name);···54385426 spec = NULL; /* rbd_dev now owns this */54395427 rbd_opts = NULL; /* rbd_dev now owns this */5440542854415441- rc = rbd_dev_image_probe(rbd_dev, true);54295429+ rc = rbd_dev_image_probe(rbd_dev, 0);54425430 if (rc < 0)54435431 goto err_out_rbd_dev;54445432
···184184 goto cleanup;185185 }186186187187- fence_get(work->excl);188188- for (i = 0; i < work->shared_count; ++i)189189- fence_get(work->shared[i]);190190-191187 amdgpu_bo_get_tiling_flags(new_rbo, &tiling_flags);192188 amdgpu_bo_unreserve(new_rbo);193189
+11-2
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
···294294 struct amdgpu_device *adev = dev_get_drvdata(dev);295295 umode_t effective_mode = attr->mode;296296297297- /* Skip limit attributes if DPM is not enabled */297297+ /* Skip attributes if DPM is not enabled */298298 if (!adev->pm.dpm_enabled &&299299 (attr == &sensor_dev_attr_temp1_crit.dev_attr.attr ||300300- attr == &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr))300300+ attr == &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr ||301301+ attr == &sensor_dev_attr_pwm1.dev_attr.attr ||302302+ attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr ||303303+ attr == &sensor_dev_attr_pwm1_max.dev_attr.attr ||304304+ attr == &sensor_dev_attr_pwm1_min.dev_attr.attr))301305 return 0;302306303307 /* Skip fan attributes if fan is not present */···695691{696692 int ret;697693694694+ if (adev->pm.sysfs_initialized)695695+ return 0;696696+698697 if (adev->pm.funcs->get_temperature == NULL)699698 return 0;700699 adev->pm.int_hwmon_dev = hwmon_device_register_with_groups(adev->dev,···725718 DRM_ERROR("Failed to register debugfs file for dpm!\n");726719 return ret;727720 }721721+722722+ adev->pm.sysfs_initialized = true;728723729724 return 0;730725}
+3
drivers/gpu/drm/amd/amdgpu/kv_dpm.c
···29972997 struct amdgpu_device *adev = (struct amdgpu_device *)handle;29982998 int ret;2999299930003000+ if (!amdgpu_dpm)30013001+ return 0;30023002+30003003 /* init the sysfs and debugfs files late */30013004 ret = amdgpu_pm_sysfs_init(adev);30023005 if (ret)
···143143}144144145145/**146146- * i915_gem_shrink - Shrink buffer object caches completely146146+ * i915_gem_shrink_all - Shrink buffer object caches completely147147 * @dev_priv: i915 device148148 *149149 * This is a simple wraper around i915_gem_shrink() to aggressively shrink all
+4-1
drivers/gpu/drm/i915/i915_gem_userptr.c
···804804 * Also note, that the object created here is not currently a "first class"805805 * object, in that several ioctls are banned. These are the CPU access806806 * ioctls: mmap(), pwrite and pread. In practice, you are expected to use807807- * direct access via your pointer rather than use those ioctls.807807+ * direct access via your pointer rather than use those ioctls. Another808808+ * restriction is that we do not allow userptr surfaces to be pinned to the809809+ * hardware and so we reject any attempt to create a framebuffer out of a810810+ * userptr.808811 *809812 * If you think this is a good interface to use to pass GPU memory between810813 * drivers, please use dma-buf instead. In fact, wherever possible use
+67-53
drivers/gpu/drm/i915/intel_display.c
···17241724 I915_READ(DPLL(!crtc->pipe)) | DPLL_DVO_2X_MODE);17251725 }1726172617271727+ /*17281728+ * Apparently we need to have VGA mode enabled prior to changing17291729+ * the P1/P2 dividers. Otherwise the DPLL will keep using the old17301730+ * dividers, even though the register value does change.17311731+ */17321732+ I915_WRITE(reg, 0);17331733+17341734+ I915_WRITE(reg, dpll);17351735+17271736 /* Wait for the clocks to stabilize. */17281737 POSTING_READ(reg);17291738 udelay(150);···1411614107 struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);1411714108 struct drm_i915_gem_object *obj = intel_fb->obj;14118141091411014110+ if (obj->userptr.mm) {1411114111+ DRM_DEBUG("attempting to use a userptr for a framebuffer, denied\n");1411214112+ return -EINVAL;1411314113+ }1411414114+1411914115 return drm_gem_handle_create(file, &obj->base, handle);1412014116}1412114117···1491114897 /* restore vblank interrupts to correct state */1491214898 drm_crtc_vblank_reset(&crtc->base);1491314899 if (crtc->active) {1490014900+ struct intel_plane *plane;1490114901+1491414902 drm_calc_timestamping_constants(&crtc->base, &crtc->base.hwmode);1491514903 update_scanline_offset(crtc);1491614904 drm_crtc_vblank_on(&crtc->base);1490514905+1490614906+ /* Disable everything but the primary plane */1490714907+ for_each_intel_plane_on_crtc(dev, crtc, plane) {1490814908+ if (plane->base.type == DRM_PLANE_TYPE_PRIMARY)1490914909+ continue;1491014910+1491114911+ plane->disable_plane(&plane->base, &crtc->base);1491214912+ }1491714913 }14918149141491914915 /* We need to sanitize the plane -> pipe mapping first because this will···1509115067 i915_redisable_vga_power_on(dev);1509215068}15093150691509415094-static bool primary_get_hw_state(struct intel_crtc *crtc)1507015070+static bool primary_get_hw_state(struct intel_plane *plane)1509515071{1509615096- struct drm_i915_private *dev_priv = crtc->base.dev->dev_private;1507215072+ struct drm_i915_private *dev_priv = to_i915(plane->base.dev);15097150731509815098- return !!(I915_READ(DSPCNTR(crtc->plane)) & DISPLAY_PLANE_ENABLE);1507415074+ return I915_READ(DSPCNTR(plane->plane)) & DISPLAY_PLANE_ENABLE;1509915075}15100150761510115101-static void readout_plane_state(struct intel_crtc *crtc,1510215102- struct intel_crtc_state *crtc_state)1507715077+/* FIXME read out full plane state for all planes */1507815078+static void readout_plane_state(struct intel_crtc *crtc)1510315079{1510415104- struct intel_plane *p;1510515105- struct intel_plane_state *plane_state;1510615106- bool active = crtc_state->base.active;1508015080+ struct drm_plane *primary = crtc->base.primary;1508115081+ struct intel_plane_state *plane_state =1508215082+ to_intel_plane_state(primary->state);15107150831510815108- for_each_intel_plane(crtc->base.dev, p) {1510915109- if (crtc->pipe != p->pipe)1511015110- continue;1508415084+ plane_state->visible =1508515085+ primary_get_hw_state(to_intel_plane(primary));15111150861511215112- plane_state = to_intel_plane_state(p->base.state);1511315113-1511415114- if (p->base.type == DRM_PLANE_TYPE_PRIMARY) {1511515115- plane_state->visible = primary_get_hw_state(crtc);1511615116- if (plane_state->visible)1511715117- crtc->base.state->plane_mask |=1511815118- 1 << drm_plane_index(&p->base);1511915119- } else {1512015120- if (active)1512115121- p->disable_plane(&p->base, &crtc->base);1512215122-1512315123- plane_state->visible = false;1512415124- }1512515125- }1508715087+ if (plane_state->visible)1508815088+ crtc->base.state->plane_mask |= 1 << drm_plane_index(primary);1512615089}15127150901512815091static void intel_modeset_readout_hw_state(struct drm_device *dev)···1513215121 crtc->base.state->active = crtc->active;1513315122 crtc->base.enabled = crtc->active;15134151231513515135- memset(&crtc->base.mode, 0, sizeof(crtc->base.mode));1513615136- if (crtc->base.state->active) {1513715137- intel_mode_from_pipe_config(&crtc->base.mode, crtc->config);1513815138- intel_mode_from_pipe_config(&crtc->base.state->adjusted_mode, crtc->config);1513915139- WARN_ON(drm_atomic_set_mode_for_crtc(crtc->base.state, &crtc->base.mode));1514015140-1514115141- /*1514215142- * The initial mode needs to be set in order to keep1514315143- * the atomic core happy. It wants a valid mode if the1514415144- * crtc's enabled, so we do the above call.1514515145- *1514615146- * At this point some state updated by the connectors1514715147- * in their ->detect() callback has not run yet, so1514815148- * no recalculation can be done yet.1514915149- *1515015150- * Even if we could do a recalculation and modeset1515115151- * right now it would cause a double modeset if1515215152- * fbdev or userspace chooses a different initial mode.1515315153- *1515415154- * If that happens, someone indicated they wanted a1515515155- * mode change, which means it's safe to do a full1515615156- * recalculation.1515715157- */1515815158- crtc->base.state->mode.private_flags = I915_MODE_FLAG_INHERITED;1515915159- }1516015160-1516115161- crtc->base.hwmode = crtc->config->base.adjusted_mode;1516215162- readout_plane_state(crtc, to_intel_crtc_state(crtc->base.state));1512415124+ readout_plane_state(crtc);15163151251516415126 DRM_DEBUG_KMS("[CRTC:%d] hw state readout: %s\n",1516515127 crtc->base.base.id,···1519015206 connector->base.base.id,1519115207 connector->base.name,1519215208 connector->base.encoder ? "enabled" : "disabled");1520915209+ }1521015210+1521115211+ for_each_intel_crtc(dev, crtc) {1521215212+ crtc->base.hwmode = crtc->config->base.adjusted_mode;1521315213+1521415214+ memset(&crtc->base.mode, 0, sizeof(crtc->base.mode));1521515215+ if (crtc->base.state->active) {1521615216+ intel_mode_from_pipe_config(&crtc->base.mode, crtc->config);1521715217+ intel_mode_from_pipe_config(&crtc->base.state->adjusted_mode, crtc->config);1521815218+ WARN_ON(drm_atomic_set_mode_for_crtc(crtc->base.state, &crtc->base.mode));1521915219+1522015220+ /*1522115221+ * The initial mode needs to be set in order to keep1522215222+ * the atomic core happy. It wants a valid mode if the1522315223+ * crtc's enabled, so we do the above call.1522415224+ *1522515225+ * At this point some state updated by the connectors1522615226+ * in their ->detect() callback has not run yet, so1522715227+ * no recalculation can be done yet.1522815228+ *1522915229+ * Even if we could do a recalculation and modeset1523015230+ * right now it would cause a double modeset if1523115231+ * fbdev or userspace chooses a different initial mode.1523215232+ *1523315233+ * If that happens, someone indicated they wanted a1523415234+ * mode change, which means it's safe to do a full1523515235+ * recalculation.1523615236+ */1523715237+ crtc->base.state->mode.private_flags = I915_MODE_FLAG_INHERITED;1523815238+ }1519315239 }1519415240}1519515241
+1
drivers/gpu/drm/i915/intel_lrc.c
···16591659 if (flush_domains) {16601660 flags |= PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH;16611661 flags |= PIPE_CONTROL_DEPTH_CACHE_FLUSH;16621662+ flags |= PIPE_CONTROL_FLUSH_ENABLE;16621663 }1663166416641665 if (invalidate_domains) {
+2
drivers/gpu/drm/i915/intel_ringbuffer.c
···347347 if (flush_domains) {348348 flags |= PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH;349349 flags |= PIPE_CONTROL_DEPTH_CACHE_FLUSH;350350+ flags |= PIPE_CONTROL_FLUSH_ENABLE;350351 }351352 if (invalidate_domains) {352353 flags |= PIPE_CONTROL_TLB_INVALIDATE;···419418 if (flush_domains) {420419 flags |= PIPE_CONTROL_RENDER_TARGET_CACHE_FLUSH;421420 flags |= PIPE_CONTROL_DEPTH_CACHE_FLUSH;421421+ flags |= PIPE_CONTROL_FLUSH_ENABLE;422422 }423423 if (invalidate_domains) {424424 flags |= PIPE_CONTROL_TLB_INVALIDATE;
+3-2
drivers/gpu/drm/nouveau/nouveau_gem.c
···227227 struct nouveau_bo *nvbo = nouveau_gem_object(gem);228228 struct nvkm_vma *vma;229229230230- if (nvbo->bo.mem.mem_type == TTM_PL_TT)230230+ if (is_power_of_2(nvbo->valid_domains))231231+ rep->domain = nvbo->valid_domains;232232+ else if (nvbo->bo.mem.mem_type == TTM_PL_TT)231233 rep->domain = NOUVEAU_GEM_DOMAIN_GART;232234 else233235 rep->domain = NOUVEAU_GEM_DOMAIN_VRAM;234234-235236 rep->offset = nvbo->bo.offset;236237 if (cli->vm) {237238 vma = nouveau_bo_vma_find(nvbo, cli->vm);
···717717 struct radeon_device *rdev = dev_get_drvdata(dev);718718 umode_t effective_mode = attr->mode;719719720720- /* Skip limit attributes if DPM is not enabled */720720+ /* Skip attributes if DPM is not enabled */721721 if (rdev->pm.pm_method != PM_METHOD_DPM &&722722 (attr == &sensor_dev_attr_temp1_crit.dev_attr.attr ||723723- attr == &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr))723723+ attr == &sensor_dev_attr_temp1_crit_hyst.dev_attr.attr ||724724+ attr == &sensor_dev_attr_pwm1.dev_attr.attr ||725725+ attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr ||726726+ attr == &sensor_dev_attr_pwm1_max.dev_attr.attr ||727727+ attr == &sensor_dev_attr_pwm1_min.dev_attr.attr))724728 return 0;725729726730 /* Skip fan attributes if fan is not present */···1528152415291525 if (rdev->pm.pm_method == PM_METHOD_DPM) {15301526 if (rdev->pm.dpm_enabled) {15311531- ret = device_create_file(rdev->dev, &dev_attr_power_dpm_state);15321532- if (ret)15331533- DRM_ERROR("failed to create device file for dpm state\n");15341534- ret = device_create_file(rdev->dev, &dev_attr_power_dpm_force_performance_level);15351535- if (ret)15361536- DRM_ERROR("failed to create device file for dpm state\n");15371537- /* XXX: these are noops for dpm but are here for backwards compat */15381538- ret = device_create_file(rdev->dev, &dev_attr_power_profile);15391539- if (ret)15401540- DRM_ERROR("failed to create device file for power profile\n");15411541- ret = device_create_file(rdev->dev, &dev_attr_power_method);15421542- if (ret)15431543- DRM_ERROR("failed to create device file for power method\n");15271527+ if (!rdev->pm.sysfs_initialized) {15281528+ ret = device_create_file(rdev->dev, &dev_attr_power_dpm_state);15291529+ if (ret)15301530+ DRM_ERROR("failed to create device file for dpm state\n");15311531+ ret = device_create_file(rdev->dev, &dev_attr_power_dpm_force_performance_level);15321532+ if (ret)15331533+ DRM_ERROR("failed to create device file for dpm state\n");15341534+ /* XXX: these are noops for dpm but are here for backwards compat */15351535+ ret = device_create_file(rdev->dev, &dev_attr_power_profile);15361536+ if (ret)15371537+ DRM_ERROR("failed to create device file for power profile\n");15381538+ ret = device_create_file(rdev->dev, &dev_attr_power_method);15391539+ if (ret)15401540+ DRM_ERROR("failed to create device file for power method\n");15411541+ if (!ret)15421542+ rdev->pm.sysfs_initialized = true;15431543+ }1544154415451545 mutex_lock(&rdev->pm.mutex);15461546 ret = radeon_dpm_late_enable(rdev);···15601552 }15611553 }15621554 } else {15631563- if (rdev->pm.num_power_states > 1) {15551555+ if ((rdev->pm.num_power_states > 1) &&15561556+ (!rdev->pm.sysfs_initialized)) {15641557 /* where's the best place to put these? */15651558 ret = device_create_file(rdev->dev, &dev_attr_power_profile);15661559 if (ret)···15691560 ret = device_create_file(rdev->dev, &dev_attr_power_method);15701561 if (ret)15711562 DRM_ERROR("failed to create device file for power method\n");15631563+ if (!ret)15641564+ rdev->pm.sysfs_initialized = true;15721565 }15731566 }15741567 return ret;
+20-14
drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c
···415415 *416416 * Calls vmw_cmdbuf_ctx_process() on all contexts. If any context has417417 * command buffers left that are not submitted to hardware, Make sure418418- * IRQ handling is turned on. Otherwise, make sure it's turned off. This419419- * function may return -EAGAIN to indicate it should be rerun due to420420- * possibly missed IRQs if IRQs has just been turned on.418418+ * IRQ handling is turned on. Otherwise, make sure it's turned off.421419 */422422-static int vmw_cmdbuf_man_process(struct vmw_cmdbuf_man *man)420420+static void vmw_cmdbuf_man_process(struct vmw_cmdbuf_man *man)423421{424424- int notempty = 0;422422+ int notempty;425423 struct vmw_cmdbuf_context *ctx;426424 int i;427425426426+retry:427427+ notempty = 0;428428 for_each_cmdbuf_ctx(man, i, ctx)429429 vmw_cmdbuf_ctx_process(man, ctx, ¬empty);430430···440440 man->irq_on = true;441441442442 /* Rerun in case we just missed an irq. */443443- return -EAGAIN;443443+ goto retry;444444 }445445-446446- return 0;447445}448446449447/**···466468 header->cb_context = cb_context;467469 list_add_tail(&header->list, &man->ctx[cb_context].submitted);468470469469- if (vmw_cmdbuf_man_process(man) == -EAGAIN)470470- vmw_cmdbuf_man_process(man);471471+ vmw_cmdbuf_man_process(man);471472}472473473474/**···485488 struct vmw_cmdbuf_man *man = (struct vmw_cmdbuf_man *) data;486489487490 spin_lock(&man->lock);488488- if (vmw_cmdbuf_man_process(man) == -EAGAIN)489489- (void) vmw_cmdbuf_man_process(man);491491+ vmw_cmdbuf_man_process(man);490492 spin_unlock(&man->lock);491493}492494···503507 struct vmw_cmdbuf_man *man =504508 container_of(work, struct vmw_cmdbuf_man, work);505509 struct vmw_cmdbuf_header *entry, *next;510510+ uint32_t dummy;506511 bool restart = false;507512508513 spin_lock_bh(&man->lock);···520523 if (restart && vmw_cmdbuf_startstop(man, true))521524 DRM_ERROR("Failed restarting command buffer context 0.\n");522525526526+ /* Send a new fence in case one was removed */527527+ vmw_fifo_send_fence(man->dev_priv, &dummy);523528}524529525530/**···681682 DRM_MM_SEARCH_DEFAULT,682683 DRM_MM_CREATE_DEFAULT);683684 if (ret) {684684- (void) vmw_cmdbuf_man_process(man);685685+ vmw_cmdbuf_man_process(man);685686 ret = drm_mm_insert_node_generic(&man->mm, info->node,686687 info->page_size, 0, 0,687688 DRM_MM_SEARCH_DEFAULT,···11671168 drm_mm_init(&man->mm, 0, size >> PAGE_SHIFT);1168116911691170 man->has_pool = true;11701170- man->default_size = default_size;11711171+11721172+ /*11731173+ * For now, set the default size to VMW_CMDBUF_INLINE_SIZE to11741174+ * prevent deadlocks from happening when vmw_cmdbuf_space_pool()11751175+ * needs to wait for space and we block on further command11761176+ * submissions to be able to free up space.11771177+ */11781178+ man->default_size = VMW_CMDBUF_INLINE_SIZE;11711179 DRM_INFO("Using command buffers with %s pool.\n",11721180 (man->using_mob) ? "MOB" : "DMA");11731181
-2
drivers/i2c/busses/i2c-mv64xxx.c
···669669 struct i2c_msg *msgs = drv_data->msgs;670670 int num = drv_data->num_msgs;671671672672- return false;673673-674672 if (!drv_data->offload_enabled)675673 return false;676674
···3939 * far_copies (stored in second byte of layout)4040 * far_offset (stored in bit 16 of layout )4141 * use_far_sets (stored in bit 17 of layout )4242+ * use_far_sets_bugfixed (stored in bit 18 of layout )4243 *4344 * The data to be stored is divided into chunks using chunksize. Each device4445 * is divided into far_copies sections. In each section, chunks are laid out···14981497 seq_printf(seq, " %d offset-copies", conf->geo.far_copies);14991498 else15001499 seq_printf(seq, " %d far-copies", conf->geo.far_copies);15001500+ if (conf->geo.far_set_size != conf->geo.raid_disks)15011501+ seq_printf(seq, " %d devices per set", conf->geo.far_set_size);15011502 }15021503 seq_printf(seq, " [%d/%d] [", conf->geo.raid_disks,15031504 conf->geo.raid_disks - mddev->degraded);···24702467 choose_data_offset(r10_bio, rdev) +24712468 (sector - r10_bio->sector));24722469 wbio->bi_bdev = rdev->bdev;24732473- if (submit_bio_wait(WRITE, wbio) == 0)24702470+ if (submit_bio_wait(WRITE, wbio) < 0)24742471 /* Failure! */24752472 ok = rdev_set_badblocks(rdev, sector,24762473 sectors, 0)···26572654 rdev_dec_pending(rdev, conf->mddev);26582655 }26592656 }26602660- if (test_bit(R10BIO_WriteError,26612661- &r10_bio->state))26622662- close_write(r10_bio);26632657 if (fail) {26642658 spin_lock_irq(&conf->device_lock);26652659 list_add(&r10_bio->retry_list, &conf->bio_end_io_list);26662660 spin_unlock_irq(&conf->device_lock);26672661 md_wakeup_thread(conf->mddev->thread);26682668- } else26622662+ } else {26632663+ if (test_bit(R10BIO_WriteError,26642664+ &r10_bio->state))26652665+ close_write(r10_bio);26692666 raid_end_bio_io(r10_bio);26672667+ }26702668 }26712669}26722670···26952691 r10_bio = list_first_entry(&tmp, struct r10bio,26962692 retry_list);26972693 list_del(&r10_bio->retry_list);26942694+ if (mddev->degraded)26952695+ set_bit(R10BIO_Degraded, &r10_bio->state);26962696+26972697+ if (test_bit(R10BIO_WriteError,26982698+ &r10_bio->state))26992699+ close_write(r10_bio);26982700 raid_end_bio_io(r10_bio);26992701 }27002702 }···33973387 disks = mddev->raid_disks + mddev->delta_disks;33983388 break;33993389 }34003400- if (layout >> 18)33903390+ if (layout >> 19)34013391 return -1;34023392 if (chunk < (PAGE_SIZE >> 9) ||34033393 !is_power_of_2(chunk))···34093399 geo->near_copies = nc;34103400 geo->far_copies = fc;34113401 geo->far_offset = fo;34123412- geo->far_set_size = (layout & (1<<17)) ? disks / fc : disks;34023402+ switch (layout >> 17) {34033403+ case 0: /* original layout. simple but not always optimal */34043404+ geo->far_set_size = disks;34053405+ break;34063406+ case 1: /* "improved" layout which was buggy. Hopefully no-one is34073407+ * actually using this, but leave code here just in case.*/34083408+ geo->far_set_size = disks/fc;34093409+ WARN(geo->far_set_size < fc,34103410+ "This RAID10 layout does not provide data safety - please backup and create new array\n");34113411+ break;34123412+ case 2: /* "improved" layout fixed to match documentation */34133413+ geo->far_set_size = fc * nc;34143414+ break;34153415+ default: /* Not a valid layout */34163416+ return -1;34173417+ }34133418 geo->chunk_mask = chunk - 1;34143419 geo->chunk_shift = ffz(~chunk);34153420 return nc*fc;
···4747# Used by LED subsystem flash drivers4848config V4L2_FLASH_LED_CLASS4949 tristate "V4L2 flash API for LED flash class devices"5050- depends on VIDEO_V4L2_SUBDEV_API5050+ depends on VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API5151 depends on LEDS_CLASS_FLASH5252 ---help---5353 Say Y here to enable V4L2 flash API support for LED flash
+9-3
drivers/memory/Kconfig
···5858 memory drives like NOR, NAND, OneNAND, SRAM.59596060config OMAP_GPMC_DEBUG6161- bool6161+ bool "Enable GPMC debug output and skip reset of GPMC during init"6262 depends on OMAP_GPMC6363 help6464 Enables verbose debugging mostly to decode the bootloader provided6565- timings. Enable this during development to configure devices6666- connected to the GPMC bus.6565+ timings. To preserve the bootloader provided timings, the reset6666+ of GPMC is skipped during init. Enable this during development to6767+ configure devices connected to the GPMC bus.6868+6969+ NOTE: In addition to matching the register setup with the bootloader7070+ you also need to match the GPMC FCLK frequency used by the7171+ bootloader or else the GPMC timings won't be identical with the7272+ bootloader timings.67736874config MVEBU_DEVBUS6975 bool "Marvell EBU Device Bus Controller"
+1-1
drivers/memory/omap-gpmc.c
···696696 int div;697697 u32 l;698698699699- gpmc_cs_show_timings(cs, "before gpmc_cs_set_timings");700699 div = gpmc_calc_divider(t->sync_clk);701700 if (div < 0)702701 return div;···19871988 if (ret < 0)19881989 goto err;1989199019911991+ gpmc_cs_show_timings(cs, "before gpmc_cs_program_settings");19901992 ret = gpmc_cs_program_settings(cs, &gpmc_s);19911993 if (ret < 0)19921994 goto err;
···19241924static int mmc_reset(struct mmc_host *host)19251925{19261926 struct mmc_card *card = host->card;19271927- u32 status;1928192719291928 if (!(host->caps & MMC_CAP_HW_RESET) || !host->ops->hw_reset)19301929 return -EOPNOTSUPP;···19351936 mmc_set_clock(host, host->f_init);1936193719371938 host->ops->hw_reset(host);19381938-19391939- /* If the reset has happened, then a status command will fail */19401940- if (!mmc_send_status(card, &status)) {19411941- mmc_host_clk_release(host);19421942- return -ENOSYS;19431943- }1944193919451940 /* Set initial state and call mmc_set_ios */19461941 mmc_set_initial_state(host);
+1-1
drivers/net/ethernet/amd/xgbe/xgbe-dev.c
···15951595 packet->rdesc_count, 1);1596159615971597 /* Make sure ownership is written to the descriptor */15981598- wmb();15981598+ smp_wmb();1599159916001600 ring->cur = cur_index + 1;16011601 if (!packet->skb->xmit_more ||
+4
drivers/net/ethernet/amd/xgbe/xgbe-drv.c
···18201820 return 0;1821182118221822 cur = ring->cur;18231823+18241824+ /* Be sure we get ring->cur before accessing descriptor data */18251825+ smp_rmb();18261826+18231827 txq = netdev_get_tx_queue(netdev, channel->queue_index);1824182818251829 while ((processed < XGBE_TX_DESC_MAX_PROC) &&
+29-13
drivers/net/ethernet/cavium/thunder/nic_main.c
···22222323struct nicpf {2424 struct pci_dev *pdev;2525- u8 rev_id;2625 u8 node;2726 unsigned int flags;2827 u8 num_vf_en; /* No of VF enabled */···4344 u8 duplex[MAX_LMAC];4445 u32 speed[MAX_LMAC];4546 u16 cpi_base[MAX_NUM_VFS_SUPPORTED];4747+ u16 rssi_base[MAX_NUM_VFS_SUPPORTED];4648 u16 rss_ind_tbl_size;4749 bool mbx_lock[MAX_NUM_VFS_SUPPORTED];4850···5353 struct msix_entry msix_entries[NIC_PF_MSIX_VECTORS];5454 bool irq_allocated[NIC_PF_MSIX_VECTORS];5555};5656+5757+static inline bool pass1_silicon(struct nicpf *nic)5858+{5959+ return nic->pdev->revision < 8;6060+}56615762/* Supported devices */5863static const struct pci_device_id nic_id_table[] = {···122117 * when PF writes to MBOX(1), in next revisions when123118 * PF writes to MBOX(0)124119 */125125- if (nic->rev_id == 0) {120120+ if (pass1_silicon(nic)) {126121 /* see the comment for nic_reg_write()/nic_reg_read()127122 * functions above128123 */···310305{311306 int i;312307313313- /* Reset NIC, in case the driver is repeatedly inserted and removed */314314- nic_reg_write(nic, NIC_PF_SOFT_RESET, 1);315315-316308 /* Enable NIC HW block */317309 nic_reg_write(nic, NIC_PF_CFG, 0x3);318310···397395 padd = cpi % 8; /* 3 bits CS out of 6bits DSCP */398396399397 /* Leave RSS_SIZE as '0' to disable RSS */400400- nic_reg_write(nic, NIC_PF_CPI_0_2047_CFG | (cpi << 3),401401- (vnic << 24) | (padd << 16) | (rssi_base + rssi));398398+ if (pass1_silicon(nic)) {399399+ nic_reg_write(nic, NIC_PF_CPI_0_2047_CFG | (cpi << 3),400400+ (vnic << 24) | (padd << 16) |401401+ (rssi_base + rssi));402402+ } else {403403+ /* Set MPI_ALG to '0' to disable MCAM parsing */404404+ nic_reg_write(nic, NIC_PF_CPI_0_2047_CFG | (cpi << 3),405405+ (padd << 16));406406+ /* MPI index is same as CPI if MPI_ALG is not enabled */407407+ nic_reg_write(nic, NIC_PF_MPI_0_2047_CFG | (cpi << 3),408408+ (vnic << 24) | (rssi_base + rssi));409409+ }402410403411 if ((rssi + 1) >= cfg->rq_cnt)404412 continue;···421409 rssi = ((cpi - cpi_base) & 0x38) >> 3;422410 }423411 nic->cpi_base[cfg->vf_id] = cpi_base;412412+ nic->rssi_base[cfg->vf_id] = rssi_base;424413}425414426415/* Responsds to VF with its RSS indirection table size */···447434{448435 u8 qset, idx = 0;449436 u64 cpi_cfg, cpi_base, rssi_base, rssi;437437+ u64 idx_addr;450438451451- cpi_base = nic->cpi_base[cfg->vf_id];452452- cpi_cfg = nic_reg_read(nic, NIC_PF_CPI_0_2047_CFG | (cpi_base << 3));453453- rssi_base = (cpi_cfg & 0x0FFF) + cfg->tbl_offset;439439+ rssi_base = nic->rssi_base[cfg->vf_id] + cfg->tbl_offset;454440455441 rssi = rssi_base;456442 qset = cfg->vf_id;···466454 idx++;467455 }468456457457+ cpi_base = nic->cpi_base[cfg->vf_id];458458+ if (pass1_silicon(nic))459459+ idx_addr = NIC_PF_CPI_0_2047_CFG;460460+ else461461+ idx_addr = NIC_PF_MPI_0_2047_CFG;462462+ cpi_cfg = nic_reg_read(nic, idx_addr | (cpi_base << 3));469463 cpi_cfg &= ~(0xFULL << 20);470464 cpi_cfg |= (cfg->hash_bits << 20);471471- nic_reg_write(nic, NIC_PF_CPI_0_2047_CFG | (cpi_base << 3), cpi_cfg);465465+ nic_reg_write(nic, idx_addr | (cpi_base << 3), cpi_cfg);472466}473467474468/* 4 level transmit side scheduler configutation···10181000 err = -ENOMEM;10191001 goto err_release_regions;10201002 }10211021-10221022- pci_read_config_byte(pdev, PCI_REVISION_ID, &nic->rev_id);1023100310241004 nic->node = nic_get_node_id(pdev);10251005
···196196 return;197197 }198198199199- memcpy(s_eqe, eqe, dev->caps.eqe_size - 1);199199+ memcpy(s_eqe, eqe, sizeof(struct mlx4_eqe) - 1);200200 s_eqe->slave_id = slave;201201 /* ensure all information is written before setting the ownersip bit */202202 dma_wmb();
+11-13
drivers/net/ethernet/nvidia/forcedeth.c
···40764076 struct fe_priv *np = netdev_priv(dev);40774077 u8 __iomem *base = get_hwbase(dev);40784078 u32 mask = 0;40794079+ unsigned long flags;40804080+ unsigned int irq = 0;4079408140804082 /*40814083 * First disable irq(s) and then···4087408540884086 if (!using_multi_irqs(dev)) {40894087 if (np->msi_flags & NV_MSI_X_ENABLED)40904090- disable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);40884088+ irq = np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector;40914089 else40924092- disable_irq_lockdep(np->pci_dev->irq);40904090+ irq = np->pci_dev->irq;40934091 mask = np->irqmask;40944092 } else {40954093 if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) {40964096- disable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector);40944094+ irq = np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector;40974095 mask |= NVREG_IRQ_RX_ALL;40984096 }40994097 if (np->nic_poll_irq & NVREG_IRQ_TX_ALL) {41004100- disable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector);40984098+ irq = np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector;41014099 mask |= NVREG_IRQ_TX_ALL;41024100 }41034101 if (np->nic_poll_irq & NVREG_IRQ_OTHER) {41044104- disable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector);41024102+ irq = np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector;41054103 mask |= NVREG_IRQ_OTHER;41064104 }41074105 }41084108- /* disable_irq() contains synchronize_irq, thus no irq handler can run now */41064106+41074107+ disable_irq_nosync_lockdep_irqsave(irq, &flags);41084108+ synchronize_irq(irq);4109410941104110 if (np->recover_error) {41114111 np->recover_error = 0;···41604156 nv_nic_irq_optimized(0, dev);41614157 else41624158 nv_nic_irq(0, dev);41634163- if (np->msi_flags & NV_MSI_X_ENABLED)41644164- enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_ALL].vector);41654165- else41664166- enable_irq_lockdep(np->pci_dev->irq);41674159 } else {41684160 if (np->nic_poll_irq & NVREG_IRQ_RX_ALL) {41694161 np->nic_poll_irq &= ~NVREG_IRQ_RX_ALL;41704162 nv_nic_irq_rx(0, dev);41714171- enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_RX].vector);41724163 }41734164 if (np->nic_poll_irq & NVREG_IRQ_TX_ALL) {41744165 np->nic_poll_irq &= ~NVREG_IRQ_TX_ALL;41754166 nv_nic_irq_tx(0, dev);41764176- enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_TX].vector);41774167 }41784168 if (np->nic_poll_irq & NVREG_IRQ_OTHER) {41794169 np->nic_poll_irq &= ~NVREG_IRQ_OTHER;41804170 nv_nic_irq_other(0, dev);41814181- enable_irq_lockdep(np->msi_x_entry[NV_MSI_X_VECTOR_OTHER].vector);41824171 }41834172 }4184417341744174+ enable_irq_lockdep_irqrestore(irq, &flags);41854175}4186417641874177#ifdef CONFIG_NET_POLL_CONTROLLER
+7-7
drivers/net/ethernet/renesas/sh_eth.c
···11271127 struct sh_eth_txdesc *txdesc = NULL;11281128 int rx_ringsize = sizeof(*rxdesc) * mdp->num_rx_ring;11291129 int tx_ringsize = sizeof(*txdesc) * mdp->num_tx_ring;11301130- int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN - 1;11301130+ int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN + 32 - 1;11311131 dma_addr_t dma_addr;1132113211331133 mdp->cur_rx = 0;···1148114811491149 /* RX descriptor */11501150 rxdesc = &mdp->rx_ring[i];11511151- /* The size of the buffer is a multiple of 16 bytes. */11521152- rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 16);11511151+ /* The size of the buffer is a multiple of 32 bytes. */11521152+ rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 32);11531153 dma_addr = dma_map_single(&ndev->dev, skb->data,11541154 rxdesc->buffer_length,11551155 DMA_FROM_DEVICE);···14501450 struct sk_buff *skb;14511451 u16 pkt_len = 0;14521452 u32 desc_status;14531453- int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN - 1;14531453+ int skbuff_size = mdp->rx_buf_sz + SH_ETH_RX_ALIGN + 32 - 1;14541454 dma_addr_t dma_addr;1455145514561456 boguscnt = min(boguscnt, *quota);···15061506 if (mdp->cd->rpadir)15071507 skb_reserve(skb, NET_IP_ALIGN);15081508 dma_unmap_single(&ndev->dev, rxdesc->addr,15091509- ALIGN(mdp->rx_buf_sz, 16),15091509+ ALIGN(mdp->rx_buf_sz, 32),15101510 DMA_FROM_DEVICE);15111511 skb_put(skb, pkt_len);15121512 skb->protocol = eth_type_trans(skb, ndev);···15241524 for (; mdp->cur_rx - mdp->dirty_rx > 0; mdp->dirty_rx++) {15251525 entry = mdp->dirty_rx % mdp->num_rx_ring;15261526 rxdesc = &mdp->rx_ring[entry];15271527- /* The size of the buffer is 16 byte boundary. */15281528- rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 16);15271527+ /* The size of the buffer is 32 byte boundary. */15281528+ rxdesc->buffer_length = ALIGN(mdp->rx_buf_sz, 32);1529152915301530 if (mdp->rx_skbuff[entry] == NULL) {15311531 skb = netdev_alloc_skb(ndev, skbuff_size);
+6-2
drivers/net/ethernet/ti/netcp_ethss.c
···26372637 mac_phy_link = true;2638263826392639 slave->open = true;26402640- if (gbe_dev->num_slaves >= gbe_dev->max_num_slaves)26402640+ if (gbe_dev->num_slaves >= gbe_dev->max_num_slaves) {26412641+ of_node_put(port);26412642 break;26432643+ }26422644 }2643264526442646 /* of_phy_connect() is needed only for MAC-PHY interface */···31393137 continue;31403138 }31413139 gbe_dev->num_slaves++;31423142- if (gbe_dev->num_slaves >= gbe_dev->max_num_slaves)31403140+ if (gbe_dev->num_slaves >= gbe_dev->max_num_slaves) {31413141+ of_node_put(interface);31433142 break;31433143+ }31443144 }31453145 of_node_put(interfaces);31463146
+2
drivers/net/phy/mdio-mux-mmioreg.c
···113113 if (!iprop || len != sizeof(uint32_t)) {114114 dev_err(&pdev->dev, "mdio-mux child node %s is "115115 "missing a 'reg' property\n", np2->full_name);116116+ of_node_put(np2);116117 return -ENODEV;117118 }118119 if (be32_to_cpup(iprop) & ~s->mask) {119120 dev_err(&pdev->dev, "mdio-mux child node %s has "120121 "a 'reg' value with unmasked bits\n",121122 np2->full_name);123123+ of_node_put(np2);122124 return -ENODEV;123125 }124126 }
+1
drivers/net/phy/mdio-mux.c
···144144 dev_err(dev,145145 "Error: Failed to allocate memory for child\n");146146 ret_val = -ENOMEM;147147+ of_node_put(child_bus_node);147148 break;148149 }149150 cb->bus_number = v;
···216216 if (ret)217217 return ret;218218219219- if (!node_online(node))219219+ if (node >= MAX_NUMNODES || !node_online(node))220220 return -EINVAL;221221222222 add_taint(TAINT_FIRMWARE_WORKAROUND, LOCKDEP_STILL_OK);
+8-2
drivers/perf/arm_pmu.c
···823823 }824824825825 /* Now look up the logical CPU number */826826- for_each_possible_cpu(cpu)827827- if (dn == of_cpu_device_node_get(cpu))826826+ for_each_possible_cpu(cpu) {827827+ struct device_node *cpu_dn;828828+829829+ cpu_dn = of_cpu_device_node_get(cpu);830830+ of_node_put(cpu_dn);831831+832832+ if (dn == cpu_dn)828833 break;834834+ }829835830836 if (cpu >= nr_cpu_ids) {831837 pr_warn("Failed to find logical CPU for %s\n",
+1-1
drivers/staging/iio/accel/sca3000_ring.c
···116116 if (ret)117117 goto error_ret;118118119119- for (i = 0; i < num_read; i++)119119+ for (i = 0; i < num_read / sizeof(u16); i++)120120 *(((u16 *)rx) + i) = be16_to_cpup((__be16 *)rx + i);121121122122 if (copy_to_user(buf, rx, num_read))
+5-4
drivers/staging/iio/adc/mxs-lradc.c
···915915 case IIO_CHAN_INFO_OFFSET:916916 if (chan->type == IIO_TEMP) {917917 /* The calculated value from the ADC is in Kelvin, we918918- * want Celsius for hwmon so the offset is919919- * -272.15 * scale918918+ * want Celsius for hwmon so the offset is -273.15919919+ * The offset is applied before scaling so it is920920+ * actually -213.15 * 4 / 1.012 = -1079.644268920921 */921921- *val = -1075;922922- *val2 = 691699;922922+ *val = -1079;923923+ *val2 = 644268;923924924925 return IIO_VAL_INT_PLUS_MICRO;925926 }
+1-1
drivers/thermal/samsung/exynos_tmu.c
···932932933933 if (data->soc == SOC_ARCH_EXYNOS5260)934934 emul_con = EXYNOS5260_EMUL_CON;935935- if (data->soc == SOC_ARCH_EXYNOS5433)935935+ else if (data->soc == SOC_ARCH_EXYNOS5433)936936 emul_con = EXYNOS5433_TMU_EMUL_CON;937937 else if (data->soc == SOC_ARCH_EXYNOS7)938938 emul_con = EXYNOS7_TMU_REG_EMUL_CON;
···21912191 }21922192 /* Fast path - was this the last TRB in the TD for this URB? */21932193 } else if (event_trb == td->last_trb) {21942194+ if (td->urb_length_set && trb_comp_code == COMP_SHORT_TX)21952195+ return finish_td(xhci, td, event_trb, event, ep,21962196+ status, false);21972197+21942198 if (EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)) != 0) {21952199 td->urb->actual_length =21962200 td->urb->transfer_buffer_length -···22462242 td->urb->actual_length +=22472243 TRB_LEN(le32_to_cpu(cur_trb->generic.field[2])) -22482244 EVENT_TRB_LEN(le32_to_cpu(event->transfer_len));22452245+22462246+ if (trb_comp_code == COMP_SHORT_TX) {22472247+ xhci_dbg(xhci, "mid bulk/intr SP, wait for last TRB event\n");22482248+ td->urb_length_set = true;22492249+ return 0;22502250+ }22492251 }2250225222512253 return finish_td(xhci, td, event_trb, event, ep, status, false);···22842274 u32 trb_comp_code;22852275 int ret = 0;22862276 int td_num = 0;22772277+ bool handling_skipped_tds = false;2287227822882279 slot_id = TRB_TO_SLOT_ID(le32_to_cpu(event->flags));22892280 xdev = xhci->devs[slot_id];···24202409 */24212410 ep->skip = true;24222411 xhci_dbg(xhci, "Miss service interval error, set skip flag\n");24122412+ goto cleanup;24132413+ case COMP_PING_ERR:24142414+ ep->skip = true;24152415+ xhci_dbg(xhci, "No Ping response error, Skip one Isoc TD\n");24232416 goto cleanup;24242417 default:24252418 if (xhci_is_vendor_info_code(xhci, trb_comp_code)) {···25612546 ep, &status);2562254725632548cleanup:25492549+25502550+25512551+ handling_skipped_tds = ep->skip &&25522552+ trb_comp_code != COMP_MISSED_INT &&25532553+ trb_comp_code != COMP_PING_ERR;25542554+25642555 /*25652565- * Do not update event ring dequeue pointer if ep->skip is set.25662566- * Will roll back to continue process missed tds.25562556+ * Do not update event ring dequeue pointer if we're in a loop25572557+ * processing missed tds.25672558 */25682568- if (trb_comp_code == COMP_MISSED_INT || !ep->skip) {25592559+ if (!handling_skipped_tds)25692560 inc_deq(xhci, xhci->event_ring);25702570- }2571256125722562 if (ret) {25732563 urb = td->urb;···26072587 * Process them as short transfer until reach the td pointed by26082588 * the event.26092589 */26102610- } while (ep->skip && trb_comp_code != COMP_MISSED_INT);25902590+ } while (handling_skipped_tds);2611259126122592 return 0;26132593}
···25842584 alloc_start);25852585 if (ret)25862586 goto out;25872587- } else {25872587+ } else if (offset + len > inode->i_size) {25882588 /*25892589 * If we are fallocating from the end of the file onward we25902590 * need to zero out the end of the page if i_size lands in the
···544544 mntput(ufs->upper_mnt);545545 for (i = 0; i < ufs->numlower; i++)546546 mntput(ufs->lower_mnt[i]);547547+ kfree(ufs->lower_mnt);547548548549 kfree(ufs->config.lowerdir);549550 kfree(ufs->config.upperdir);···10491048 oe->lowerstack[i].dentry = stack[i].dentry;10501049 oe->lowerstack[i].mnt = ufs->lower_mnt[i];10511050 }10511051+ kfree(stack);1052105210531053 root_dentry->d_fsdata = oe;10541054
+3
include/linux/backing-dev-defs.h
···116116 struct list_head work_list;117117 struct delayed_work dwork; /* work item used for writeback */118118119119+ struct list_head bdi_node; /* anchored at bdi->wb_list */120120+119121#ifdef CONFIG_CGROUP_WRITEBACK120122 struct percpu_ref refcnt; /* used only for !root wb's */121123 struct fprop_local_percpu memcg_completions;···152150 atomic_long_t tot_write_bandwidth;153151154152 struct bdi_writeback wb; /* the root writeback info for this bdi */153153+ struct list_head wb_list; /* list of all wbs */155154#ifdef CONFIG_CGROUP_WRITEBACK156155 struct radix_tree_root cgwb_tree; /* radix tree of active cgroup wbs */157156 struct rb_root cgwb_congested_tree; /* their congested states */
+5-64
include/linux/backing-dev.h
···1919#include <linux/slab.h>20202121int __must_check bdi_init(struct backing_dev_info *bdi);2222-void bdi_destroy(struct backing_dev_info *bdi);2222+void bdi_exit(struct backing_dev_info *bdi);23232424__printf(3, 4)2525int bdi_register(struct backing_dev_info *bdi, struct device *parent,2626 const char *fmt, ...);2727int bdi_register_dev(struct backing_dev_info *bdi, dev_t dev);2828+void bdi_unregister(struct backing_dev_info *bdi);2929+2830int __must_check bdi_setup_and_register(struct backing_dev_info *, char *);3131+void bdi_destroy(struct backing_dev_info *bdi);3232+2933void wb_start_writeback(struct bdi_writeback *wb, long nr_pages,3034 bool range_cyclic, enum wb_reason reason);3135void wb_start_background_writeback(struct bdi_writeback *wb);···412408 rcu_read_unlock();413409}414410415415-struct wb_iter {416416- int start_memcg_id;417417- struct radix_tree_iter tree_iter;418418- void **slot;419419-};420420-421421-static inline struct bdi_writeback *__wb_iter_next(struct wb_iter *iter,422422- struct backing_dev_info *bdi)423423-{424424- struct radix_tree_iter *titer = &iter->tree_iter;425425-426426- WARN_ON_ONCE(!rcu_read_lock_held());427427-428428- if (iter->start_memcg_id >= 0) {429429- iter->slot = radix_tree_iter_init(titer, iter->start_memcg_id);430430- iter->start_memcg_id = -1;431431- } else {432432- iter->slot = radix_tree_next_slot(iter->slot, titer, 0);433433- }434434-435435- if (!iter->slot)436436- iter->slot = radix_tree_next_chunk(&bdi->cgwb_tree, titer, 0);437437- if (iter->slot)438438- return *iter->slot;439439- return NULL;440440-}441441-442442-static inline struct bdi_writeback *__wb_iter_init(struct wb_iter *iter,443443- struct backing_dev_info *bdi,444444- int start_memcg_id)445445-{446446- iter->start_memcg_id = start_memcg_id;447447-448448- if (start_memcg_id)449449- return __wb_iter_next(iter, bdi);450450- else451451- return &bdi->wb;452452-}453453-454454-/**455455- * bdi_for_each_wb - walk all wb's of a bdi in ascending memcg ID order456456- * @wb_cur: cursor struct bdi_writeback pointer457457- * @bdi: bdi to walk wb's of458458- * @iter: pointer to struct wb_iter to be used as iteration buffer459459- * @start_memcg_id: memcg ID to start iteration from460460- *461461- * Iterate @wb_cur through the wb's (bdi_writeback's) of @bdi in ascending462462- * memcg ID order starting from @start_memcg_id. @iter is struct wb_iter463463- * to be used as temp storage during iteration. rcu_read_lock() must be464464- * held throughout iteration.465465- */466466-#define bdi_for_each_wb(wb_cur, bdi, iter, start_memcg_id) \467467- for ((wb_cur) = __wb_iter_init(iter, bdi, start_memcg_id); \468468- (wb_cur); (wb_cur) = __wb_iter_next(iter, bdi))469469-470411#else /* CONFIG_CGROUP_WRITEBACK */471412472413static inline bool inode_cgwb_enabled(struct inode *inode)···470521static inline void wb_blkcg_offline(struct blkcg *blkcg)471522{472523}473473-474474-struct wb_iter {475475- int next_id;476476-};477477-478478-#define bdi_for_each_wb(wb_cur, bdi, iter, start_blkcg_id) \479479- for ((iter)->next_id = (start_blkcg_id); \480480- ({ (wb_cur) = !(iter)->next_id++ ? &(bdi)->wb : NULL; }); )481524482525static inline int inode_congested(struct inode *inode, int cong_bits)483526{
···2626extern int cma_init_reserved_mem(phys_addr_t base, phys_addr_t size,2727 unsigned int order_per_bit,2828 struct cma **res_cma);2929-extern struct page *cma_alloc(struct cma *cma, unsigned int count, unsigned int align);2929+extern struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align);3030extern bool cma_release(struct cma *cma, const struct page *pages, unsigned int count);3131#endif
+11-2
include/linux/compiler-gcc.h
···237237#define KASAN_ABI_VERSION 3238238#endif239239240240-#if GCC_VERSION >= 50000241241-#define CC_HAVE_BUILTIN_OVERFLOW240240+#if GCC_VERSION >= 40902241241+/*242242+ * Tell the compiler that address safety instrumentation (KASAN)243243+ * should not be applied to that function.244244+ * Conflicts with inlining: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368245245+ */246246+#define __no_sanitize_address __attribute__((no_sanitize_address))242247#endif243248244249#endif /* gcc version >= 40000 specific checks */245250246251#if !defined(__noclone)247252#define __noclone /* not needed */253253+#endif254254+255255+#if !defined(__no_sanitize_address)256256+#define __no_sanitize_address248257#endif249258250259/*
+53-13
include/linux/compiler.h
···198198199199#include <uapi/linux/types.h>200200201201-static __always_inline void __read_once_size(const volatile void *p, void *res, int size)201201+#define __READ_ONCE_SIZE \202202+({ \203203+ switch (size) { \204204+ case 1: *(__u8 *)res = *(volatile __u8 *)p; break; \205205+ case 2: *(__u16 *)res = *(volatile __u16 *)p; break; \206206+ case 4: *(__u32 *)res = *(volatile __u32 *)p; break; \207207+ case 8: *(__u64 *)res = *(volatile __u64 *)p; break; \208208+ default: \209209+ barrier(); \210210+ __builtin_memcpy((void *)res, (const void *)p, size); \211211+ barrier(); \212212+ } \213213+})214214+215215+static __always_inline216216+void __read_once_size(const volatile void *p, void *res, int size)202217{203203- switch (size) {204204- case 1: *(__u8 *)res = *(volatile __u8 *)p; break;205205- case 2: *(__u16 *)res = *(volatile __u16 *)p; break;206206- case 4: *(__u32 *)res = *(volatile __u32 *)p; break;207207- case 8: *(__u64 *)res = *(volatile __u64 *)p; break;208208- default:209209- barrier();210210- __builtin_memcpy((void *)res, (const void *)p, size);211211- barrier();212212- }218218+ __READ_ONCE_SIZE;213219}220220+221221+#ifdef CONFIG_KASAN222222+/*223223+ * This function is not 'inline' because __no_sanitize_address confilcts224224+ * with inlining. Attempt to inline it may cause a build failure.225225+ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368226226+ * '__maybe_unused' allows us to avoid defined-but-not-used warnings.227227+ */228228+static __no_sanitize_address __maybe_unused229229+void __read_once_size_nocheck(const volatile void *p, void *res, int size)230230+{231231+ __READ_ONCE_SIZE;232232+}233233+#else234234+static __always_inline235235+void __read_once_size_nocheck(const volatile void *p, void *res, int size)236236+{237237+ __READ_ONCE_SIZE;238238+}239239+#endif214240215241static __always_inline void __write_once_size(volatile void *p, void *res, int size)216242{···274248 * required ordering.275249 */276250277277-#define READ_ONCE(x) \278278- ({ union { typeof(x) __val; char __c[1]; } __u; __read_once_size(&(x), __u.__c, sizeof(x)); __u.__val; })251251+#define __READ_ONCE(x, check) \252252+({ \253253+ union { typeof(x) __val; char __c[1]; } __u; \254254+ if (check) \255255+ __read_once_size(&(x), __u.__c, sizeof(x)); \256256+ else \257257+ __read_once_size_nocheck(&(x), __u.__c, sizeof(x)); \258258+ __u.__val; \259259+})260260+#define READ_ONCE(x) __READ_ONCE(x, 1)261261+262262+/*263263+ * Use READ_ONCE_NOCHECK() instead of READ_ONCE() if you need264264+ * to hide memory access from KASAN.265265+ */266266+#define READ_ONCE_NOCHECK(x) __READ_ONCE(x, 0)279267280268#define WRITE_ONCE(x, val) \281269({ \
+2-2
include/linux/dma-contiguous.h
···111111 return ret;112112}113113114114-struct page *dma_alloc_from_contiguous(struct device *dev, int count,114114+struct page *dma_alloc_from_contiguous(struct device *dev, size_t count,115115 unsigned int order);116116bool dma_release_from_contiguous(struct device *dev, struct page *pages,117117 int count);···144144}145145146146static inline147147-struct page *dma_alloc_from_contiguous(struct device *dev, int count,147147+struct page *dma_alloc_from_contiguous(struct device *dev, size_t count,148148 unsigned int order)149149{150150 return NULL;
+5-3
include/linux/memcontrol.h
···676676677677struct list_head *mem_cgroup_cgwb_list(struct mem_cgroup *memcg);678678struct wb_domain *mem_cgroup_wb_domain(struct bdi_writeback *wb);679679-void mem_cgroup_wb_stats(struct bdi_writeback *wb, unsigned long *pavail,680680- unsigned long *pdirty, unsigned long *pwriteback);679679+void mem_cgroup_wb_stats(struct bdi_writeback *wb, unsigned long *pfilepages,680680+ unsigned long *pheadroom, unsigned long *pdirty,681681+ unsigned long *pwriteback);681682682683#else /* CONFIG_CGROUP_WRITEBACK */683684···688687}689688690689static inline void mem_cgroup_wb_stats(struct bdi_writeback *wb,691691- unsigned long *pavail,690690+ unsigned long *pfilepages,691691+ unsigned long *pheadroom,692692 unsigned long *pdirty,693693 unsigned long *pwriteback)694694{
-18
include/linux/overflow-arith.h
···11-#pragma once22-33-#include <linux/kernel.h>44-55-#ifdef CC_HAVE_BUILTIN_OVERFLOW66-77-#define overflow_usub __builtin_usub_overflow88-99-#else1010-1111-static inline bool overflow_usub(unsigned int a, unsigned int b,1212- unsigned int *res)1313-{1414- *res = a - b;1515- return *res > a ? true : false;1616-}1717-1818-#endif
···119119#define WM8904_MIC_REGS 2120120#define WM8904_GPIO_REGS 4121121#define WM8904_DRC_REGS 4122122-#define WM8904_EQ_REGS 25122122+#define WM8904_EQ_REGS 24123123124124/**125125 * DRC configurations are specified with a label and a set of register
+6-2
kernel/kmod.c
···327327 call_usermodehelper_exec_sync(sub_info);328328 } else {329329 pid_t pid;330330-330330+ /*331331+ * Use CLONE_PARENT to reparent it to kthreadd; we do not332332+ * want to pollute current->children, and we need a parent333333+ * that always ignores SIGCHLD to ensure auto-reaping.334334+ */331335 pid = kernel_thread(call_usermodehelper_exec_async, sub_info,332332- SIGCHLD);336336+ CLONE_PARENT | SIGCHLD);333337 if (pid < 0) {334338 sub_info->retval = pid;335339 umh_complete(sub_info);
+6-2
kernel/module.c
···10631063 if (core_kernel_text(a))10641064 return;1065106510661066- /* module_text_address is safe here: we're supposed to have reference10671067- * to module from symbol_get, so it can't go away. */10661066+ /*10671067+ * Even though we hold a reference on the module; we still need to10681068+ * disable preemption in order to safely traverse the data structure.10691069+ */10701070+ preempt_disable();10681071 modaddr = __module_text_address(a);10691072 BUG_ON(!modaddr);10701073 module_put(modaddr);10741074+ preempt_enable();10711075}10721076EXPORT_SYMBOL_GPL(symbol_put_addr);10731077
+8-4
kernel/sched/core.c
···23662366 trace_sched_wakeup_new(p);23672367 check_preempt_curr(rq, p, WF_FORK);23682368#ifdef CONFIG_SMP23692369- if (p->sched_class->task_woken)23692369+ if (p->sched_class->task_woken) {23702370+ /*23712371+ * Nothing relies on rq->lock after this, so its fine to23722372+ * drop it.23732373+ */23742374+ lockdep_unpin_lock(&rq->lock);23702375 p->sched_class->task_woken(rq, p);23762376+ lockdep_pin_lock(&rq->lock);23772377+ }23712378#endif23722379 task_rq_unlock(rq, p, &flags);23732380}···7244723772457238 alloc_cpumask_var(&non_isolated_cpus, GFP_KERNEL);72467239 alloc_cpumask_var(&fallback_doms, GFP_KERNEL);72477247-72487248- /* nohz_full won't take effect without isolating the cpus. */72497249- tick_nohz_full_add_cpus_to(cpu_isolated_map);7250724072517241 sched_init_numa();72527242
+13-4
kernel/sched/deadline.c
···668668 * Queueing this task back might have overloaded rq, check if we need669669 * to kick someone away.670670 */671671- if (has_pushable_dl_tasks(rq))671671+ if (has_pushable_dl_tasks(rq)) {672672+ /*673673+ * Nothing relies on rq->lock after this, so its safe to drop674674+ * rq->lock.675675+ */676676+ lockdep_unpin_lock(&rq->lock);672677 push_dl_task(rq);678678+ lockdep_pin_lock(&rq->lock);679679+ }673680#endif674681675682unlock:···10731066 int target = find_later_rq(p);1074106710751068 if (target != -1 &&10761076- dl_time_before(p->dl.deadline,10771077- cpu_rq(target)->dl.earliest_dl.curr))10691069+ (dl_time_before(p->dl.deadline,10701070+ cpu_rq(target)->dl.earliest_dl.curr) ||10711071+ (cpu_rq(target)->dl.dl_nr_running == 0)))10781072 cpu = target;10791073 }10801074 rcu_read_unlock();···1425141714261418 later_rq = cpu_rq(cpu);1427141914281428- if (!dl_time_before(task->dl.deadline,14201420+ if (later_rq->dl.dl_nr_running &&14211421+ !dl_time_before(task->dl.deadline,14291422 later_rq->dl.earliest_dl.curr)) {14301423 /*14311424 * Target rq has tasks of equal or earlier deadline,
+5-4
kernel/sched/fair.c
···23632363 */23642364 tg_weight = atomic_long_read(&tg->load_avg);23652365 tg_weight -= cfs_rq->tg_load_avg_contrib;23662366- tg_weight += cfs_rq_load_avg(cfs_rq);23662366+ tg_weight += cfs_rq->load.weight;2367236723682368 return tg_weight;23692369}···23732373 long tg_weight, load, shares;2374237423752375 tg_weight = calc_tg_weight(tg, cfs_rq);23762376- load = cfs_rq_load_avg(cfs_rq);23762376+ load = cfs_rq->load.weight;2377237723782378 shares = (tg->shares * load);23792379 if (tg_weight)···26642664/* Group cfs_rq's load_avg is used for task_h_load and update_cfs_share */26652665static inline int update_cfs_rq_load_avg(u64 now, struct cfs_rq *cfs_rq)26662666{26672667- int decayed;26682667 struct sched_avg *sa = &cfs_rq->avg;26682668+ int decayed, removed = 0;2669266926702670 if (atomic_long_read(&cfs_rq->removed_load_avg)) {26712671 long r = atomic_long_xchg(&cfs_rq->removed_load_avg, 0);26722672 sa->load_avg = max_t(long, sa->load_avg - r, 0);26732673 sa->load_sum = max_t(s64, sa->load_sum - r * LOAD_AVG_MAX, 0);26742674+ removed = 1;26742675 }2675267626762677 if (atomic_long_read(&cfs_rq->removed_util_avg)) {···26892688 cfs_rq->load_last_update_time_copy = sa->last_update_time;26902689#endif2691269026922692- return decayed;26912691+ return decayed || removed;26932692}2694269326952694/* Update task and its cfs_rq load average */
···8585 if (!object_is_on_stack(stack))8686 return;87878888+ /* Can't do this from NMI context (can cause deadlocks) */8989+ if (in_nmi())9090+ return;9191+8892 local_irq_save(flags);8993 arch_spin_lock(&max_stack_lock);9494+9595+ /*9696+ * RCU may not be watching, make it see us.9797+ * The stack trace code uses rcu_sched.9898+ */9999+ rcu_irq_enter();9010091101 /* In case another CPU set the tracer_frame on us */92102 if (unlikely(!frame_size))···179169 }180170181171 out:172172+ rcu_irq_exit();182173 arch_spin_unlock(&max_stack_lock);183174 local_irq_restore(flags);184175}
+1
lib/Kconfig.debug
···197197config FRAME_WARN198198 int "Warn for stack frames larger than (needs gcc 4.4)"199199 range 0 8192200200+ default 0 if KASAN200201 default 1024 if !64BIT201202 default 2048 if 64BIT202203 help
+1-1
lib/fault-inject.c
···4444 printk(KERN_NOTICE "FAULT_INJECTION: forcing a failure.\n"4545 "name %pd, interval %lu, probability %lu, "4646 "space %d, times %d\n", attr->dname,4747- attr->probability, attr->interval,4747+ attr->interval, attr->probability,4848 atomic_read(&attr->space),4949 atomic_read(&attr->times));5050 if (attr->verbose > 1)
···361361 * This function allocates part of contiguous memory on specific362362 * contiguous memory area.363363 */364364-struct page *cma_alloc(struct cma *cma, unsigned int count, unsigned int align)364364+struct page *cma_alloc(struct cma *cma, size_t count, unsigned int align)365365{366366 unsigned long mask, offset, pfn, start = 0;367367 unsigned long bitmap_maxno, bitmap_no, bitmap_count;···371371 if (!cma || !cma->count)372372 return NULL;373373374374- pr_debug("%s(cma %p, count %d, align %d)\n", __func__, (void *)cma,374374+ pr_debug("%s(cma %p, count %zu, align %d)\n", __func__, (void *)cma,375375 count, align);376376377377 if (!count)
+5-4
mm/filemap.c
···24882488 break;24892489 }2490249024912491+ if (fatal_signal_pending(current)) {24922492+ status = -EINTR;24932493+ break;24942494+ }24952495+24912496 status = a_ops->write_begin(file, mapping, pos, bytes, flags,24922497 &page, &fsdata);24932498 if (unlikely(status < 0))···25302525 written += copied;2531252625322527 balance_dirty_pages_ratelimited(mapping);25332533- if (fatal_signal_pending(current)) {25342534- status = -EINTR;25352535- break;25362536- }25372528 } while (iov_iter_count(i));2538252925392530 return written ? written : status;
+2-1
mm/huge_memory.c
···22062206 for (_pte = pte; _pte < pte+HPAGE_PMD_NR;22072207 _pte++, address += PAGE_SIZE) {22082208 pte_t pteval = *_pte;22092209- if (pte_none(pteval) || is_zero_pfn(pte_pfn(pteval))) {22092209+ if (pte_none(pteval) || (pte_present(pteval) &&22102210+ is_zero_pfn(pte_pfn(pteval)))) {22102211 if (!userfaultfd_armed(vma) &&22112212 ++none_or_zero <= khugepaged_max_ptes_none)22122213 continue;
+17-18
mm/memcontrol.c
···37413741/**37423742 * mem_cgroup_wb_stats - retrieve writeback related stats from its memcg37433743 * @wb: bdi_writeback in question37443744- * @pavail: out parameter for number of available pages37443744+ * @pfilepages: out parameter for number of file pages37453745+ * @pheadroom: out parameter for number of allocatable pages according to memcg37453746 * @pdirty: out parameter for number of dirty pages37463747 * @pwriteback: out parameter for number of pages under writeback37473748 *37483748- * Determine the numbers of available, dirty, and writeback pages in @wb's37493749- * memcg. Dirty and writeback are self-explanatory. Available is a bit37503750- * more involved.37493749+ * Determine the numbers of file, headroom, dirty, and writeback pages in37503750+ * @wb's memcg. File, dirty and writeback are self-explanatory. Headroom37513751+ * is a bit more involved.37513752 *37523752- * A memcg's headroom is "min(max, high) - used". The available memory is37533753- * calculated as the lowest headroom of itself and the ancestors plus the37543754- * number of pages already being used for file pages. Note that this37553755- * doesn't consider the actual amount of available memory in the system.37563756- * The caller should further cap *@pavail accordingly.37533753+ * A memcg's headroom is "min(max, high) - used". In the hierarchy, the37543754+ * headroom is calculated as the lowest headroom of itself and the37553755+ * ancestors. Note that this doesn't consider the actual amount of37563756+ * available memory in the system. The caller should further cap37573757+ * *@pheadroom accordingly.37573758 */37583758-void mem_cgroup_wb_stats(struct bdi_writeback *wb, unsigned long *pavail,37593759- unsigned long *pdirty, unsigned long *pwriteback)37593759+void mem_cgroup_wb_stats(struct bdi_writeback *wb, unsigned long *pfilepages,37603760+ unsigned long *pheadroom, unsigned long *pdirty,37613761+ unsigned long *pwriteback)37603762{37613763 struct mem_cgroup *memcg = mem_cgroup_from_css(wb->memcg_css);37623764 struct mem_cgroup *parent;37633763- unsigned long head_room = PAGE_COUNTER_MAX;37643764- unsigned long file_pages;3765376537663766 *pdirty = mem_cgroup_read_stat(memcg, MEM_CGROUP_STAT_DIRTY);3767376737683768 /* this should eventually include NR_UNSTABLE_NFS */37693769 *pwriteback = mem_cgroup_read_stat(memcg, MEM_CGROUP_STAT_WRITEBACK);37703770+ *pfilepages = mem_cgroup_nr_lru_pages(memcg, (1 << LRU_INACTIVE_FILE) |37713771+ (1 << LRU_ACTIVE_FILE));37723772+ *pheadroom = PAGE_COUNTER_MAX;3770377337713771- file_pages = mem_cgroup_nr_lru_pages(memcg, (1 << LRU_INACTIVE_FILE) |37723772- (1 << LRU_ACTIVE_FILE));37733774 while ((parent = parent_mem_cgroup(memcg))) {37743775 unsigned long ceiling = min(memcg->memory.limit, memcg->high);37753776 unsigned long used = page_counter_read(&memcg->memory);3776377737773777- head_room = min(head_room, ceiling - min(ceiling, used));37783778+ *pheadroom = min(*pheadroom, ceiling - min(ceiling, used));37783779 memcg = parent;37793780 }37803780-37813781- *pavail = file_pages + head_room;37823781}3783378237843783#else /* CONFIG_CGROUP_WRITEBACK */
+32-22
mm/page-writeback.c
···145145 unsigned long pos_ratio;146146};147147148148-#define DTC_INIT_COMMON(__wb) .wb = (__wb), \149149- .wb_completions = &(__wb)->completions150150-151148/*152149 * Length of period for aging writeout fractions of bdis. This is an153150 * arbitrarily chosen number. The longer the period, the slower fractions will···154157155158#ifdef CONFIG_CGROUP_WRITEBACK156159157157-#define GDTC_INIT(__wb) .dom = &global_wb_domain, \158158- DTC_INIT_COMMON(__wb)160160+#define GDTC_INIT(__wb) .wb = (__wb), \161161+ .dom = &global_wb_domain, \162162+ .wb_completions = &(__wb)->completions163163+159164#define GDTC_INIT_NO_WB .dom = &global_wb_domain160160-#define MDTC_INIT(__wb, __gdtc) .dom = mem_cgroup_wb_domain(__wb), \161161- .gdtc = __gdtc, \162162- DTC_INIT_COMMON(__wb)165165+166166+#define MDTC_INIT(__wb, __gdtc) .wb = (__wb), \167167+ .dom = mem_cgroup_wb_domain(__wb), \168168+ .wb_completions = &(__wb)->memcg_completions, \169169+ .gdtc = __gdtc163170164171static bool mdtc_valid(struct dirty_throttle_control *dtc)165172{···214213215214#else /* CONFIG_CGROUP_WRITEBACK */216215217217-#define GDTC_INIT(__wb) DTC_INIT_COMMON(__wb)216216+#define GDTC_INIT(__wb) .wb = (__wb), \217217+ .wb_completions = &(__wb)->completions218218#define GDTC_INIT_NO_WB219219#define MDTC_INIT(__wb, __gdtc)220220···684682 return max(thresh, dom->dirty_limit);685683}686684687687-/* memory available to a memcg domain is capped by system-wide clean memory */688688-static void mdtc_cap_avail(struct dirty_throttle_control *mdtc)685685+/*686686+ * Memory which can be further allocated to a memcg domain is capped by687687+ * system-wide clean memory excluding the amount being used in the domain.688688+ */689689+static void mdtc_calc_avail(struct dirty_throttle_control *mdtc,690690+ unsigned long filepages, unsigned long headroom)689691{690692 struct dirty_throttle_control *gdtc = mdtc_gdtc(mdtc);691691- unsigned long clean = gdtc->avail - min(gdtc->avail, gdtc->dirty);693693+ unsigned long clean = filepages - min(filepages, mdtc->dirty);694694+ unsigned long global_clean = gdtc->avail - min(gdtc->avail, gdtc->dirty);695695+ unsigned long other_clean = global_clean - min(global_clean, clean);692696693693- mdtc->avail = min(mdtc->avail, clean);697697+ mdtc->avail = filepages + min(headroom, other_clean);694698}695699696700/**···15701562 }1571156315721564 if (mdtc) {15731573- unsigned long writeback;15651565+ unsigned long filepages, headroom, writeback;1574156615751567 /*15761568 * If @wb belongs to !root memcg, repeat the same15771569 * basic calculations for the memcg domain.15781570 */15791579- mem_cgroup_wb_stats(wb, &mdtc->avail, &mdtc->dirty,15801580- &writeback);15811581- mdtc_cap_avail(mdtc);15711571+ mem_cgroup_wb_stats(wb, &filepages, &headroom,15721572+ &mdtc->dirty, &writeback);15821573 mdtc->dirty += writeback;15741574+ mdtc_calc_avail(mdtc, filepages, headroom);1583157515841576 domain_dirty_limits(mdtc);15851577···19011893 return true;1902189419031895 if (mdtc) {19041904- unsigned long writeback;18961896+ unsigned long filepages, headroom, writeback;1905189719061906- mem_cgroup_wb_stats(wb, &mdtc->avail, &mdtc->dirty, &writeback);19071907- mdtc_cap_avail(mdtc);18981898+ mem_cgroup_wb_stats(wb, &filepages, &headroom, &mdtc->dirty,18991899+ &writeback);19001900+ mdtc_calc_avail(mdtc, filepages, headroom);19081901 domain_dirty_limits(mdtc); /* ditto, ignore writeback */1909190219101903 if (mdtc->dirty > mdtc->bg_thresh)···19651956 int nr_pages = global_page_state(NR_FILE_DIRTY) +19661957 global_page_state(NR_UNSTABLE_NFS);19671958 struct bdi_writeback *wb;19681968- struct wb_iter iter;1969195919701960 /*19711961 * We want to write everything out, not just down to the dirty···19731965 if (!bdi_has_dirty_io(&q->backing_dev_info))19741966 return;1975196719761976- bdi_for_each_wb(wb, &q->backing_dev_info, &iter, 0)19681968+ rcu_read_lock();19691969+ list_for_each_entry_rcu(wb, &q->backing_dev_info.wb_list, bdi_node)19771970 if (wb_has_dirty_io(wb))19781971 wb_start_writeback(wb, nr_pages, true,19791972 WB_REASON_LAPTOP_TIMER);19731973+ rcu_read_unlock();19801974}1981197519821976/*
+1-1
net/ipv4/fib_trie.c
···15691569 do {15701570 /* record parent and next child index */15711571 pn = n;15721572- cindex = key ? get_index(key, pn) : 0;15721572+ cindex = (key > pn->key) ? get_index(key, pn) : 0;1573157315741574 if (cindex >> pn->bits)15751575 break;
···293293 return helper->help(skb, protoff, ct, ctinfo);294294}295295296296+/* Returns 0 on success, -EINPROGRESS if 'skb' is stolen, or other nonzero297297+ * value if 'skb' is freed.298298+ */296299static int handle_fragments(struct net *net, struct sw_flow_key *key,297300 u16 zone, struct sk_buff *skb)298301{···311308 return err;312309313310 ovs_cb.mru = IPCB(skb)->frag_max_size;314314- } else if (key->eth.type == htons(ETH_P_IPV6)) {315311#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6)312312+ } else if (key->eth.type == htons(ETH_P_IPV6)) {316313 enum ip6_defrag_users user = IP6_DEFRAG_CONNTRACK_IN + zone;317314 struct sk_buff *reasm;318315···321318 if (!reasm)322319 return -EINPROGRESS;323320324324- if (skb == reasm)321321+ if (skb == reasm) {322322+ kfree_skb(skb);325323 return -EINVAL;324324+ }325325+326326+ /* Don't free 'skb' even though it is one of the original327327+ * fragments, as we're going to morph it into the head.328328+ */329329+ skb_get(skb);330330+ nf_ct_frag6_consume_orig(reasm);326331327332 key->ip.proto = ipv6_hdr(reasm)->nexthdr;328333 skb_morph(skb, reasm);334334+ skb->next = reasm->next;329335 consume_skb(reasm);330336 ovs_cb.mru = IP6CB(skb)->frag_max_size;331331-#else332332- return -EPFNOSUPPORT;333337#endif334338 } else {339339+ kfree_skb(skb);335340 return -EPFNOSUPPORT;336341 }337342···484473 return false;485474}486475476476+/* Returns 0 on success, -EINPROGRESS if 'skb' is stolen, or other nonzero477477+ * value if 'skb' is freed.478478+ */487479int ovs_ct_execute(struct net *net, struct sk_buff *skb,488480 struct sw_flow_key *key,489481 const struct ovs_conntrack_info *info)···522508 &info->labels.mask);523509err:524510 skb_push(skb, nh_ofs);511511+ if (err)512512+ kfree_skb(skb);525513 return err;526514}527515
···9292#define PT_REGS_RC(x) ((x)->gprs[2])9393#define PT_REGS_SP(x) ((x)->gprs[15])94949595+#elif defined(__aarch64__)9696+9797+#define PT_REGS_PARM1(x) ((x)->regs[0])9898+#define PT_REGS_PARM2(x) ((x)->regs[1])9999+#define PT_REGS_PARM3(x) ((x)->regs[2])100100+#define PT_REGS_PARM4(x) ((x)->regs[3])101101+#define PT_REGS_PARM5(x) ((x)->regs[4])102102+#define PT_REGS_RET(x) ((x)->regs[30])103103+#define PT_REGS_FP(x) ((x)->regs[29]) /* Works only with CONFIG_FRAME_POINTER */104104+#define PT_REGS_RC(x) ((x)->regs[0])105105+#define PT_REGS_SP(x) ((x)->sp)106106+95107#endif96108#endif
+4-2
security/keys/gc.c
···134134 kdebug("- %u", key->serial);135135 key_check(key);136136137137- /* Throw away the key data */138138- if (key->type->destroy)137137+ /* Throw away the key data if the key is instantiated */138138+ if (test_bit(KEY_FLAG_INSTANTIATED, &key->flags) &&139139+ !test_bit(KEY_FLAG_NEGATIVE, &key->flags) &&140140+ key->type->destroy)139141 key->type->destroy(key);140142141143 security_key_free(key);
+3
security/keys/request_key.c
···440440441441 kenter("");442442443443+ if (ctx->index_key.type == &key_type_keyring)444444+ return ERR_PTR(-EPERM);445445+443446 user = key_user_lookup(current_fsuid());444447 if (!user)445448 return ERR_PTR(-ENOMEM);
···3808380838093809 wm8962_reset(wm8962);3810381038113811+ regcache_mark_dirty(wm8962->regmap);38123812+38113813 /* SYSCLK defaults to on; make sure it is off so we can safely38123814 * write to registers if the device is declocked.38133815 */
+28
sound/soc/soc-ops.c
···207207EXPORT_SYMBOL_GPL(snd_soc_info_volsw);208208209209/**210210+ * snd_soc_info_volsw_sx - Mixer info callback for SX TLV controls211211+ * @kcontrol: mixer control212212+ * @uinfo: control element information213213+ *214214+ * Callback to provide information about a single mixer control, or a double215215+ * mixer control that spans 2 registers of the SX TLV type. SX TLV controls216216+ * have a range that represents both positive and negative values either side217217+ * of zero but without a sign bit.218218+ *219219+ * Returns 0 for success.220220+ */221221+int snd_soc_info_volsw_sx(struct snd_kcontrol *kcontrol,222222+ struct snd_ctl_elem_info *uinfo)223223+{224224+ struct soc_mixer_control *mc =225225+ (struct soc_mixer_control *)kcontrol->private_value;226226+227227+ snd_soc_info_volsw(kcontrol, uinfo);228228+ /* Max represents the number of levels in an SX control not the229229+ * maximum value, so add the minimum value back on230230+ */231231+ uinfo->value.integer.max += mc->min;232232+233233+ return 0;234234+}235235+EXPORT_SYMBOL_GPL(snd_soc_info_volsw_sx);236236+237237+/**210238 * snd_soc_get_volsw - single mixer get callback211239 * @kcontrol: mixer control212240 * @ucontrol: control element information
+19
virt/kvm/arm/arch_timer.c
···137137void kvm_timer_flush_hwstate(struct kvm_vcpu *vcpu)138138{139139 struct arch_timer_cpu *timer = &vcpu->arch.timer_cpu;140140+ bool phys_active;141141+ int ret;140142141143 /*142144 * We're about to run this vcpu again, so there is no need to···153151 */154152 if (kvm_timer_should_fire(vcpu))155153 kvm_timer_inject_irq(vcpu);154154+155155+ /*156156+ * We keep track of whether the edge-triggered interrupt has been157157+ * signalled to the vgic/guest, and if so, we mask the interrupt and158158+ * the physical distributor to prevent the timer from raising a159159+ * physical interrupt whenever we run a guest, preventing forward160160+ * VCPU progress.161161+ */162162+ if (kvm_vgic_get_phys_irq_active(timer->map))163163+ phys_active = true;164164+ else165165+ phys_active = false;166166+167167+ ret = irq_set_irqchip_state(timer->map->irq,168168+ IRQCHIP_STATE_ACTIVE,169169+ phys_active);170170+ WARN_ON(ret);156171}157172158173/**
+55-40
virt/kvm/arm/vgic.c
···531531 return false;532532}533533534534+/*535535+ * If a mapped interrupt's state has been modified by the guest such that it536536+ * is no longer active or pending, without it have gone through the sync path,537537+ * then the map->active field must be cleared so the interrupt can be taken538538+ * again.539539+ */540540+static void vgic_handle_clear_mapped_irq(struct kvm_vcpu *vcpu)541541+{542542+ struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;543543+ struct list_head *root;544544+ struct irq_phys_map_entry *entry;545545+ struct irq_phys_map *map;546546+547547+ rcu_read_lock();548548+549549+ /* Check for PPIs */550550+ root = &vgic_cpu->irq_phys_map_list;551551+ list_for_each_entry_rcu(entry, root, entry) {552552+ map = &entry->map;553553+554554+ if (!vgic_dist_irq_is_pending(vcpu, map->virt_irq) &&555555+ !vgic_irq_is_active(vcpu, map->virt_irq))556556+ map->active = false;557557+ }558558+559559+ rcu_read_unlock();560560+}561561+534562bool vgic_handle_clear_pending_reg(struct kvm *kvm,535563 struct kvm_exit_mmio *mmio,536564 phys_addr_t offset, int vcpu_id)···589561 vcpu_id, offset);590562 vgic_reg_access(mmio, reg, offset, mode);591563564564+ vgic_handle_clear_mapped_irq(kvm_get_vcpu(kvm, vcpu_id));592565 vgic_update_state(kvm);593566 return true;594567 }···627598 ACCESS_READ_VALUE | ACCESS_WRITE_CLEARBIT);628599629600 if (mmio->is_write) {601601+ vgic_handle_clear_mapped_irq(kvm_get_vcpu(kvm, vcpu_id));630602 vgic_update_state(kvm);631603 return true;632604 }···1012982 pend_percpu = vcpu->arch.vgic_cpu.pending_percpu;1013983 pend_shared = vcpu->arch.vgic_cpu.pending_shared;1014984985985+ if (!dist->enabled) {986986+ bitmap_zero(pend_percpu, VGIC_NR_PRIVATE_IRQS);987987+ bitmap_zero(pend_shared, nr_shared);988988+ return 0;989989+ }990990+1015991 pending = vgic_bitmap_get_cpu_map(&dist->irq_pending, vcpu_id);1016992 enabled = vgic_bitmap_get_cpu_map(&dist->irq_enabled, vcpu_id);1017993 bitmap_and(pend_percpu, pending, enabled, VGIC_NR_PRIVATE_IRQS);···10441008 struct vgic_dist *dist = &kvm->arch.vgic;10451009 struct kvm_vcpu *vcpu;10461010 int c;10471047-10481048- if (!dist->enabled) {10491049- set_bit(0, dist->irq_pending_on_cpu);10501050- return;10511051- }1052101110531012 kvm_for_each_vcpu(c, vcpu, kvm) {10541013 if (compute_pending_for_cpu(vcpu))···11231092 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;11241093 struct vgic_lr vlr = vgic_get_lr(vcpu, lr_nr);1125109410951095+ /*10961096+ * We must transfer the pending state back to the distributor before10971097+ * retiring the LR, otherwise we may loose edge-triggered interrupts.10981098+ */10991099+ if (vlr.state & LR_STATE_PENDING) {11001100+ vgic_dist_irq_set_pending(vcpu, irq);11011101+ vlr.hwirq = 0;11021102+ }11031103+11261104 vlr.state = 0;11271105 vgic_set_lr(vcpu, lr_nr, vlr);11281106 clear_bit(lr_nr, vgic_cpu->lr_used);···11721132 kvm_debug("Set active, clear distributor: 0x%x\n", vlr.state);11731133 vgic_irq_clear_active(vcpu, irq);11741134 vgic_update_state(vcpu->kvm);11751175- } else if (vgic_dist_irq_is_pending(vcpu, irq)) {11351135+ } else {11361136+ WARN_ON(!vgic_dist_irq_is_pending(vcpu, irq));11761137 vlr.state |= LR_STATE_PENDING;11771138 kvm_debug("Set pending: 0x%x\n", vlr.state);11781139 }···12811240 struct vgic_cpu *vgic_cpu = &vcpu->arch.vgic_cpu;12821241 struct vgic_dist *dist = &vcpu->kvm->arch.vgic;12831242 unsigned long *pa_percpu, *pa_shared;12841284- int i, vcpu_id, lr, ret;12431243+ int i, vcpu_id;12851244 int overflow = 0;12861245 int nr_shared = vgic_nr_shared_irqs(dist);12871246···13351294 * adjust that if needed while exiting.13361295 */13371296 clear_bit(vcpu_id, dist->irq_pending_on_cpu);13381338- }13391339-13401340- for (lr = 0; lr < vgic->nr_lr; lr++) {13411341- struct vgic_lr vlr;13421342-13431343- if (!test_bit(lr, vgic_cpu->lr_used))13441344- continue;13451345-13461346- vlr = vgic_get_lr(vcpu, lr);13471347-13481348- /*13491349- * If we have a mapping, and the virtual interrupt is13501350- * presented to the guest (as pending or active), then we must13511351- * set the state to active in the physical world. See13521352- * Documentation/virtual/kvm/arm/vgic-mapped-irqs.txt.13531353- */13541354- if (vlr.state & LR_HW) {13551355- struct irq_phys_map *map;13561356- map = vgic_irq_map_search(vcpu, vlr.irq);13571357-13581358- ret = irq_set_irqchip_state(map->irq,13591359- IRQCHIP_STATE_ACTIVE,13601360- true);13611361- WARN_ON(ret);13621362- }13631297 }13641298}13651299···14371421 return 0;1438142214391423 map = vgic_irq_map_search(vcpu, vlr.irq);14401440- BUG_ON(!map || !map->active);14241424+ BUG_ON(!map);1441142514421426 ret = irq_get_irqchip_state(map->irq,14431427 IRQCHIP_STATE_ACTIVE,···1445142914461430 WARN_ON(ret);1447143114481448- if (map->active) {14491449- ret = irq_set_irqchip_state(map->irq,14501450- IRQCHIP_STATE_ACTIVE,14511451- false);14521452- WARN_ON(ret);14321432+ if (map->active)14531433 return 0;14541454- }1455143414561435 return 1;14571436}···16181607 } else {16191608 if (level_triggered) {16201609 vgic_dist_irq_clear_level(vcpu, irq_num);16211621- if (!vgic_dist_irq_soft_pend(vcpu, irq_num))16101610+ if (!vgic_dist_irq_soft_pend(vcpu, irq_num)) {16221611 vgic_dist_irq_clear_pending(vcpu, irq_num);16121612+ vgic_cpu_irq_clear(vcpu, irq_num);16131613+ if (!compute_pending_for_cpu(vcpu))16141614+ clear_bit(cpuid, dist->irq_pending_on_cpu);16151615+ }16231616 }1624161716251618 ret = false;