bd8879f8 parents f8f8074 8c32d47 0e1f37d 7f55927 aeed35f 31a8b3e 1676722 74fbc7d1847 files · +37230 −12355Browse filesShowing the changes to include/linux (63 of 1847 files). Show all
Unified · Split
| @@ -7,7 +7,12 @@ · 6 unmodified lines | ||
| 7 | 7 | #ifndef _LINUX_ADXL_H |
| 8 | 8 | #define _LINUX_ADXL_H |
| 9 | 9 | |
| 10 | +#ifdef CONFIG_ACPI_ADXL | |
| 10 | 11 | const char * const *adxl_get_component_names(void); |
| 11 | 12 | int adxl_decode(u64 addr, u64 component_values[]); |
| 13 | +#else | |
| 14 | +static inline const char * const *adxl_get_component_names(void) { return NULL; } | |
| 15 | +static inline int adxl_decode(u64 addr, u64 component_values[]) { return -EOPNOTSUPP; } | |
| 16 | +#endif | |
| 12 | 17 | |
| 13 | 18 | #endif /* _LINUX_ADXL_H */ |
| @@ -62,13 +62,19 @@ · 61 unmodified lines | ||
| 62 | 62 | /* Error Codes */ |
| 63 | 63 | enum virtchnl_status_code { |
| 64 | 64 | VIRTCHNL_STATUS_SUCCESS = 0, |
| 65 | − VIRTCHNL_ERR_PARAM = -5, | |
| 65 | + VIRTCHNL_STATUS_ERR_PARAM = -5, | |
| 66 | + VIRTCHNL_STATUS_ERR_NO_MEMORY = -18, | |
| 66 | 67 | VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH = -38, |
| 67 | 68 | VIRTCHNL_STATUS_ERR_CQP_COMPL_ERROR = -39, |
| 68 | 69 | VIRTCHNL_STATUS_ERR_INVALID_VF_ID = -40, |
| 69 | − VIRTCHNL_STATUS_NOT_SUPPORTED = -64, | |
| 70 | + VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR = -53, | |
| 71 | + VIRTCHNL_STATUS_ERR_NOT_SUPPORTED = -64, | |
| 70 | 72 | }; |
| 71 | 73 | |
| 74 | +/* Backward compatibility */ | |
| 75 | +#define VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM | |
| 76 | +#define VIRTCHNL_STATUS_NOT_SUPPORTED VIRTCHNL_STATUS_ERR_NOT_SUPPORTED | |
| 77 | + | |
| 72 | 78 | #define VIRTCHNL_LINK_SPEED_100MB_SHIFT 0x1 |
| 73 | 79 | #define VIRTCHNL_LINK_SPEED_1000MB_SHIFT 0x2 |
| 74 | 80 | #define VIRTCHNL_LINK_SPEED_10GB_SHIFT 0x3 |
| @@ -831,7 +837,7 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode, · 756 unmodified lines | ||
| 831 | 837 | case VIRTCHNL_OP_EVENT: |
| 832 | 838 | case VIRTCHNL_OP_UNKNOWN: |
| 833 | 839 | default: |
| 834 | − return VIRTCHNL_ERR_PARAM; | |
| 840 | + return VIRTCHNL_STATUS_ERR_PARAM; | |
| 835 | 841 | } |
| 836 | 842 | /* few more checks */ |
| 837 | 843 | if (err_msg_format || valid_len != msglen) |
| @@ -503,31 +503,23 @@ do { \ · 502 unmodified lines | ||
| 503 | 503 | disk_devt((bio)->bi_disk) |
| 504 | 504 | |
| 505 | 505 | #if defined(CONFIG_MEMCG) && defined(CONFIG_BLK_CGROUP) |
| 506 | −int bio_associate_blkg_from_page(struct bio *bio, struct page *page); | |
| 506 | +int bio_associate_blkcg_from_page(struct bio *bio, struct page *page); | |
| 507 | 507 | #else |
| 508 | −static inline int bio_associate_blkg_from_page(struct bio *bio, | |
| 509 | − struct page *page) { return 0; } | |
| 508 | +static inline int bio_associate_blkcg_from_page(struct bio *bio, | |
| 509 | + struct page *page) { return 0; } | |
| 510 | 510 | #endif |
| 511 | 511 | |
| 512 | 512 | #ifdef CONFIG_BLK_CGROUP |
| 513 | +int bio_associate_blkcg(struct bio *bio, struct cgroup_subsys_state *blkcg_css); | |
| 513 | 514 | int bio_associate_blkg(struct bio *bio, struct blkcg_gq *blkg); |
| 514 | −int bio_associate_blkg_from_css(struct bio *bio, | |
| 515 | − struct cgroup_subsys_state *css); | |
| 516 | −int bio_associate_create_blkg(struct request_queue *q, struct bio *bio); | |
| 517 | −int bio_reassociate_blkg(struct request_queue *q, struct bio *bio); | |
| 518 | 515 | void bio_disassociate_task(struct bio *bio); |
| 519 | −void bio_clone_blkg_association(struct bio *dst, struct bio *src); | |
| 516 | +void bio_clone_blkcg_association(struct bio *dst, struct bio *src); | |
| 520 | 517 | #else /* CONFIG_BLK_CGROUP */ |
| 521 | −static inline int bio_associate_blkg_from_css(struct bio *bio, | |
| 522 | − struct cgroup_subsys_state *css) | |
| 523 | −{ return 0; } | |
| 524 | −static inline int bio_associate_create_blkg(struct request_queue *q, | |
| 525 | − struct bio *bio) { return 0; } | |
| 526 | −static inline int bio_reassociate_blkg(struct request_queue *q, struct bio *bio) | |
| 527 | −{ return 0; } | |
| 518 | +static inline int bio_associate_blkcg(struct bio *bio, | |
| 519 | + struct cgroup_subsys_state *blkcg_css) { return 0; } | |
| 528 | 520 | static inline void bio_disassociate_task(struct bio *bio) { } |
| 529 | −static inline void bio_clone_blkg_association(struct bio *dst, | |
| 530 | − struct bio *src) { } | |
| 521 | +static inline void bio_clone_blkcg_association(struct bio *dst, | |
| 522 | + struct bio *src) { } | |
| 531 | 523 | #endif /* CONFIG_BLK_CGROUP */ |
| 532 | 524 | |
| 533 | 525 | #ifdef CONFIG_HIGHMEM |
| @@ -126,7 +126,7 @@ struct blkcg_gq { · 125 unmodified lines | ||
| 126 | 126 | struct request_list rl; |
| 127 | 127 | |
| 128 | 128 | /* reference count */ |
| 129 | − struct percpu_ref refcnt; | |
| 129 | + atomic_t refcnt; | |
| 130 | 130 | |
| 131 | 131 | /* is this blkg online? protected by both blkcg and q locks */ |
| 132 | 132 | bool online; |
| @@ -184,8 +184,6 @@ extern struct cgroup_subsys_state * const blkcg_root_css; · 51 unmodified lines | ||
| 184 | 184 | |
| 185 | 185 | struct blkcg_gq *blkg_lookup_slowpath(struct blkcg *blkcg, |
| 186 | 186 | struct request_queue *q, bool update_hint); |
| 187 | −struct blkcg_gq *__blkg_lookup_create(struct blkcg *blkcg, | |
| 188 | − struct request_queue *q); | |
| 189 | 187 | struct blkcg_gq *blkg_lookup_create(struct blkcg *blkcg, |
| 190 | 188 | struct request_queue *q); |
| 191 | 189 | int blkcg_init_queue(struct request_queue *q); |
| @@ -232,59 +230,22 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol, · 40 unmodified lines | ||
| 232 | 230 | char *input, struct blkg_conf_ctx *ctx); |
| 233 | 231 | void blkg_conf_finish(struct blkg_conf_ctx *ctx); |
| 234 | 232 | |
| 235 | −/** | |
| 236 | − * blkcg_css - find the current css | |
| 237 | − * | |
| 238 | − * Find the css associated with either the kthread or the current task. | |
| 239 | − * This may return a dying css, so it is up to the caller to use tryget logic | |
| 240 | − * to confirm it is alive and well. | |
| 241 | − */ | |
| 242 | −static inline struct cgroup_subsys_state *blkcg_css(void) | |
| 243 | −{ | |
| 244 | − struct cgroup_subsys_state *css; | |
| 245 | − | |
| 246 | − css = kthread_blkcg(); | |
| 247 | − if (css) | |
| 248 | − return css; | |
| 249 | − return task_css(current, io_cgrp_id); | |
| 250 | −} | |
| 251 | 233 | |
| 252 | 234 | static inline struct blkcg *css_to_blkcg(struct cgroup_subsys_state *css) |
| 253 | 235 | { |
| 254 | 236 | return css ? container_of(css, struct blkcg, css) : NULL; |
| 255 | 237 | } |
| 256 | 238 | |
| 257 | −/** | |
| 258 | − * __bio_blkcg - internal version of bio_blkcg for bfq and cfq | |
| 259 | − * | |
| 260 | − * DO NOT USE. | |
| 261 | − * There is a flaw using this version of the function. In particular, this was | |
| 262 | − * used in a broken paradigm where association was called on the given css. It | |
| 263 | − * is possible though that the returned css from task_css() is in the process | |
| 264 | − * of dying due to migration of the current task. So it is improper to assume | |
| 265 | − * *_get() is going to succeed. Both BFQ and CFQ rely on this logic and will | |
| 266 | − * take additional work to handle more gracefully. | |
| 267 | − */ | |
| 268 | −static inline struct blkcg *__bio_blkcg(struct bio *bio) | |
| 269 | −{ | |
| 270 | − if (bio && bio->bi_blkg) | |
| 271 | − return bio->bi_blkg->blkcg; | |
| 272 | − return css_to_blkcg(blkcg_css()); | |
| 273 | −} | |
| 274 | − | |
| 275 | −/** | |
| 276 | − * bio_blkcg - grab the blkcg associated with a bio | |
| 277 | − * @bio: target bio | |
| 278 | − * | |
| 279 | − * This returns the blkcg associated with a bio, NULL if not associated. | |
| 280 | − * Callers are expected to either handle NULL or know association has been | |
| 281 | − * done prior to calling this. | |
| 282 | − */ | |
| 283 | 239 | static inline struct blkcg *bio_blkcg(struct bio *bio) |
| 284 | 240 | { |
| 285 | − if (bio && bio->bi_blkg) | |
| 286 | − return bio->bi_blkg->blkcg; | |
| 287 | − return NULL; | |
| 241 | + struct cgroup_subsys_state *css; | |
| 242 | + | |
| 243 | + if (bio && bio->bi_css) | |
| 244 | + return css_to_blkcg(bio->bi_css); | |
| 245 | + css = kthread_blkcg(); | |
| 246 | + if (css) | |
| 247 | + return css_to_blkcg(css); | |
| 248 | + return css_to_blkcg(task_css(current, io_cgrp_id)); | |
| 288 | 249 | } |
| 289 | 250 | |
| 290 | 251 | static inline bool blk_cgroup_congested(void) |
| @@ -490,35 +451,26 @@ static inline int blkg_path(struct blkcg_gq *blkg, char *buf, int buflen) · 199 unmodified lines | ||
| 490 | 451 | */ |
| 491 | 452 | static inline void blkg_get(struct blkcg_gq *blkg) |
| 492 | 453 | { |
| 493 | − percpu_ref_get(&blkg->refcnt); | |
| 454 | + WARN_ON_ONCE(atomic_read(&blkg->refcnt) <= 0); | |
| 455 | + atomic_inc(&blkg->refcnt); | |
| 494 | 456 | } |
| 495 | 457 | |
| 496 | 458 | /** |
| 497 | − * blkg_tryget - try and get a blkg reference | |
| 459 | + * blkg_try_get - try and get a blkg reference | |
| 498 | 460 | * @blkg: blkg to get |
| 499 | 461 | * |
| 500 | 462 | * This is for use when doing an RCU lookup of the blkg. We may be in the midst |
| 501 | 463 | * of freeing this blkg, so we can only use it if the refcnt is not zero. |
| 502 | 464 | */ |
| 503 | −static inline bool blkg_tryget(struct blkcg_gq *blkg) | |
| 465 | +static inline struct blkcg_gq *blkg_try_get(struct blkcg_gq *blkg) | |
| 504 | 466 | { |
| 505 | − return percpu_ref_tryget(&blkg->refcnt); | |
| 467 | + if (atomic_inc_not_zero(&blkg->refcnt)) | |
| 468 | + return blkg; | |
| 469 | + return NULL; | |
| 506 | 470 | } |
| 507 | 471 | |
| 508 | −/** | |
| 509 | − * blkg_tryget_closest - try and get a blkg ref on the closet blkg | |
| 510 | − * @blkg: blkg to get | |
| 511 | − * | |
| 512 | − * This walks up the blkg tree to find the closest non-dying blkg and returns | |
| 513 | − * the blkg that it did association with as it may not be the passed in blkg. | |
| 514 | − */ | |
| 515 | −static inline struct blkcg_gq *blkg_tryget_closest(struct blkcg_gq *blkg) | |
| 516 | −{ | |
| 517 | − while (!percpu_ref_tryget(&blkg->refcnt)) | |
| 518 | − blkg = blkg->parent; | |
| 519 | 472 | |
| 520 | − return blkg; | |
| 521 | −} | |
| 473 | +void __blkg_release_rcu(struct rcu_head *rcu); | |
| 522 | 474 | |
| 523 | 475 | /** |
| 524 | 476 | * blkg_put - put a blkg reference |
| @@ -526,7 +478,9 @@ static inline struct blkcg_gq *blkg_tryget_closest(struct blkcg_gq *blkg) · 1 unmodified line | ||
| 526 | 478 | */ |
| 527 | 479 | static inline void blkg_put(struct blkcg_gq *blkg) |
| 528 | 480 | { |
| 529 | − percpu_ref_put(&blkg->refcnt); | |
| 481 | + WARN_ON_ONCE(atomic_read(&blkg->refcnt) <= 0); | |
| 482 | + if (atomic_dec_and_test(&blkg->refcnt)) | |
| 483 | + call_rcu(&blkg->rcu_head, __blkg_release_rcu); | |
| 530 | 484 | } |
| 531 | 485 | |
| 532 | 486 | /** |
| @@ -579,36 +533,25 @@ static inline struct request_list *blk_get_rl(struct request_queue *q, · 46 unmodified lines | ||
| 579 | 533 | |
| 580 | 534 | rcu_read_lock(); |
| 581 | 535 | |
| 582 | − if (bio && bio->bi_blkg) { | |
| 583 | − blkcg = bio->bi_blkg->blkcg; | |
| 584 | − if (blkcg == &blkcg_root) | |
| 585 | − goto rl_use_root; | |
| 586 | − | |
| 587 | − blkg_get(bio->bi_blkg); | |
| 588 | − rcu_read_unlock(); | |
| 589 | − return &bio->bi_blkg->rl; | |
| 590 | − } | |
| 536 | + blkcg = bio_blkcg(bio); | |
| 591 | 537 | |
| 592 | − blkcg = css_to_blkcg(blkcg_css()); | |
| 538 | + /* bypass blkg lookup and use @q->root_rl directly for root */ | |
| 593 | 539 | if (blkcg == &blkcg_root) |
| 594 | − goto rl_use_root; | |
| 540 | + goto root_rl; | |
| 595 | 541 | |
| 542 | + /* | |
| 543 | + * Try to use blkg->rl. blkg lookup may fail under memory pressure | |
| 544 | + * or if either the blkcg or queue is going away. Fall back to | |
| 545 | + * root_rl in such cases. | |
| 546 | + */ | |
| 596 | 547 | blkg = blkg_lookup(blkcg, q); |
| 597 | 548 | if (unlikely(!blkg)) |
| 598 | − blkg = __blkg_lookup_create(blkcg, q); | |
| 599 | − | |
| 600 | − if (blkg->blkcg == &blkcg_root || !blkg_tryget(blkg)) | |
| 601 | − goto rl_use_root; | |
| 549 | + goto root_rl; | |
| 602 | 550 | |
| 551 | + blkg_get(blkg); | |
| 603 | 552 | rcu_read_unlock(); |
| 604 | 553 | return &blkg->rl; |
| 605 | − | |
| 606 | − /* | |
| 607 | − * Each blkg has its own request_list, however, the root blkcg | |
| 608 | − * uses the request_queue's root_rl. This is to avoid most | |
| 609 | − * overhead for the root blkcg. | |
| 610 | − */ | |
| 611 | −rl_use_root: | |
| 554 | +root_rl: | |
| 612 | 555 | rcu_read_unlock(); |
| 613 | 556 | return &q->root_rl; |
| 614 | 557 | } |
| @@ -854,26 +797,32 @@ static inline bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg · 239 unmodified lines | ||
| 854 | 797 | struct bio *bio) { return false; } |
| 855 | 798 | #endif |
| 856 | 799 | |
| 857 | − | |
| 858 | −static inline void blkcg_bio_issue_init(struct bio *bio) | |
| 859 | −{ | |
| 860 | − bio_issue_init(&bio->bi_issue, bio_sectors(bio)); | |
| 861 | −} | |
| 862 | − | |
| 863 | 800 | static inline bool blkcg_bio_issue_check(struct request_queue *q, |
| 864 | 801 | struct bio *bio) |
| 865 | 802 | { |
| 803 | + struct blkcg *blkcg; | |
| 866 | 804 | struct blkcg_gq *blkg; |
| 867 | 805 | bool throtl = false; |
| 868 | 806 | |
| 869 | 807 | rcu_read_lock(); |
| 808 | + blkcg = bio_blkcg(bio); | |
| 809 | + | |
| 810 | + /* associate blkcg if bio hasn't attached one */ | |
| 811 | + bio_associate_blkcg(bio, &blkcg->css); | |
| 870 | 812 | |
| 871 | − bio_associate_create_blkg(q, bio); | |
| 872 | − blkg = bio->bi_blkg; | |
| 813 | + blkg = blkg_lookup(blkcg, q); | |
| 814 | + if (unlikely(!blkg)) { | |
| 815 | + spin_lock_irq(q->queue_lock); | |
| 816 | + blkg = blkg_lookup_create(blkcg, q); | |
| 817 | + if (IS_ERR(blkg)) | |
| 818 | + blkg = NULL; | |
| 819 | + spin_unlock_irq(q->queue_lock); | |
| 820 | + } | |
| 873 | 821 | |
| 874 | 822 | throtl = blk_throtl_bio(q, blkg, bio); |
| 875 | 823 | |
| 876 | 824 | if (!throtl) { |
| 825 | + blkg = blkg ?: q->root_blkg; | |
| 877 | 826 | /* |
| 878 | 827 | * If the bio is flagged with BIO_QUEUE_ENTERED it means this |
| 879 | 828 | * is a split bio and we would have already accounted for the |
| @@ -885,8 +834,6 @@ static inline bool blkcg_bio_issue_check(struct request_queue *q, · 5 unmodified lines | ||
| 885 | 834 | blkg_rwstat_add(&blkg->stat_ios, bio->bi_opf, 1); |
| 886 | 835 | } |
| 887 | 836 | |
| 888 | − blkcg_bio_issue_init(bio); | |
| 889 | − | |
| 890 | 837 | rcu_read_unlock(); |
| 891 | 838 | return !throtl; |
| 892 | 839 | } |
| @@ -983,7 +930,6 @@ static inline int blkcg_activate_policy(struct request_queue *q, · 90 unmodified lines | ||
| 983 | 930 | static inline void blkcg_deactivate_policy(struct request_queue *q, |
| 984 | 931 | const struct blkcg_policy *pol) { } |
| 985 | 932 | |
| 986 | −static inline struct blkcg *__bio_blkcg(struct bio *bio) { return NULL; } | |
| 987 | 933 | static inline struct blkcg *bio_blkcg(struct bio *bio) { return NULL; } |
| 988 | 934 | |
| 989 | 935 | static inline struct blkg_policy_data *blkg_to_pd(struct blkcg_gq *blkg, |
| @@ -999,7 +945,6 @@ static inline void blk_put_rl(struct request_list *rl) { } · 9 unmodified lines | ||
| 999 | 945 | static inline void blk_rq_set_rl(struct request *rq, struct request_list *rl) { } |
| 1000 | 946 | static inline struct request_list *blk_rq_rl(struct request *rq) { return &rq->q->root_rl; } |
| 1001 | 947 | |
| 1002 | −static inline void blkcg_bio_issue_init(struct bio *bio) { } | |
| 1003 | 948 | static inline bool blkcg_bio_issue_check(struct request_queue *q, |
| 1004 | 949 | struct bio *bio) { return true; } |
| 1005 | 950 | |
| @@ -178,6 +178,7 @@ struct bio { · 177 unmodified lines | ||
| 178 | 178 | * release. Read comment on top of bio_associate_current(). |
| 179 | 179 | */ |
| 180 | 180 | struct io_context *bi_ioc; |
| 181 | + struct cgroup_subsys_state *bi_css; | |
| 181 | 182 | struct blkcg_gq *bi_blkg; |
| 182 | 183 | struct bio_issue bi_issue; |
| 183 | 184 | #endif |
| @@ -51,6 +51,9 @@ struct bpf_reg_state { · 50 unmodified lines | ||
| 51 | 51 | * PTR_TO_MAP_VALUE_OR_NULL |
| 52 | 52 | */ |
| 53 | 53 | struct bpf_map *map_ptr; |
| 54 | + | |
| 55 | + /* Max size from any of the above. */ | |
| 56 | + unsigned long raw; | |
| 54 | 57 | }; |
| 55 | 58 | /* Fixed part of pointer offset, pointer types only */ |
| 56 | 59 | s32 off; |
| @@ -169,6 +169,7 @@ void can_change_state(struct net_device *dev, struct can_frame *cf, · 168 unmodified lines | ||
| 169 | 169 | |
| 170 | 170 | void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev, |
| 171 | 171 | unsigned int idx); |
| 172 | +struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr); | |
| 172 | 173 | unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx); |
| 173 | 174 | void can_free_echo_skb(struct net_device *dev, unsigned int idx); |
| 174 | 175 | |
| @@ -41,7 +41,12 @@ int can_rx_offload_add_timestamp(struct net_device *dev, struct can_rx_offload * · 40 unmodified lines | ||
| 41 | 41 | int can_rx_offload_add_fifo(struct net_device *dev, struct can_rx_offload *offload, unsigned int weight); |
| 42 | 42 | int can_rx_offload_irq_offload_timestamp(struct can_rx_offload *offload, u64 reg); |
| 43 | 43 | int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload); |
| 44 | −int can_rx_offload_irq_queue_err_skb(struct can_rx_offload *offload, struct sk_buff *skb); | |
| 44 | +int can_rx_offload_queue_sorted(struct can_rx_offload *offload, | |
| 45 | + struct sk_buff *skb, u32 timestamp); | |
| 46 | +unsigned int can_rx_offload_get_echo_skb(struct can_rx_offload *offload, | |
| 47 | + unsigned int idx, u32 timestamp); | |
| 48 | +int can_rx_offload_queue_tail(struct can_rx_offload *offload, | |
| 49 | + struct sk_buff *skb); | |
| 45 | 50 | void can_rx_offload_reset(struct can_rx_offload *offload); |
| 46 | 51 | void can_rx_offload_del(struct can_rx_offload *offload); |
| 47 | 52 | void can_rx_offload_enable(struct can_rx_offload *offload); |
| @@ -213,12 +213,6 @@ DEFINE_CEPH_FEATURE_DEPRECATED(63, 1, RESERVED_BROKEN, LUMINOUS) // client-facin · 212 unmodified lines | ||
| 213 | 213 | CEPH_FEATURE_NEW_OSDOPREPLY_ENCODING | \ |
| 214 | 214 | CEPH_FEATURE_CEPHX_V2) |
| 215 | 215 | |
| 216 | −#define CEPH_FEATURES_REQUIRED_DEFAULT \ | |
| 217 | − (CEPH_FEATURE_NOSRCADDR | \ | |
| 218 | − CEPH_FEATURE_SUBSCRIBE2 | \ | |
| 219 | − CEPH_FEATURE_RECONNECT_SEQ | \ | |
| 220 | − CEPH_FEATURE_PGID64 | \ | |
| 221 | − CEPH_FEATURE_PGPOOL3 | \ | |
| 222 | − CEPH_FEATURE_OSDENC) | |
| 216 | +#define CEPH_FEATURES_REQUIRED_DEFAULT 0 | |
| 223 | 217 | |
| 224 | 218 | #endif |
| @@ -93,8 +93,6 @@ extern struct css_set init_css_set; · 92 unmodified lines | ||
| 93 | 93 | |
| 94 | 94 | bool css_has_online_children(struct cgroup_subsys_state *css); |
| 95 | 95 | struct cgroup_subsys_state *css_from_id(int id, struct cgroup_subsys *ss); |
| 96 | −struct cgroup_subsys_state *cgroup_e_css(struct cgroup *cgroup, | |
| 97 | − struct cgroup_subsys *ss); | |
| 98 | 96 | struct cgroup_subsys_state *cgroup_get_e_css(struct cgroup *cgroup, |
| 99 | 97 | struct cgroup_subsys *ss); |
| 100 | 98 | struct cgroup_subsys_state *css_tryget_online_from_dir(struct dentry *dentry, |
| @@ -1032,9 +1032,9 @@ int kcompat_sys_fstatfs64(unsigned int fd, compat_size_t sz, · 1031 unmodified lines | ||
| 1032 | 1032 | #else /* !CONFIG_COMPAT */ |
| 1033 | 1033 | |
| 1034 | 1034 | #define is_compat_task() (0) |
| 1035 | −#ifndef in_compat_syscall | |
| 1035 | +/* Ensure no one redefines in_compat_syscall() under !CONFIG_COMPAT */ | |
| 1036 | +#define in_compat_syscall in_compat_syscall | |
| 1036 | 1037 | static inline bool in_compat_syscall(void) { return false; } |
| 1037 | −#endif | |
| 1038 | 1038 | |
| 1039 | 1039 | #endif /* CONFIG_COMPAT */ |
| 1040 | 1040 | |
| @@ -21,8 +21,6 @@ · 20 unmodified lines | ||
| 21 | 21 | #define __SANITIZE_ADDRESS__ |
| 22 | 22 | #endif |
| 23 | 23 | |
| 24 | −#define __no_sanitize_address __attribute__((no_sanitize("address"))) | |
| 25 | − | |
| 26 | 24 | /* |
| 27 | 25 | * Not all versions of clang implement the the type-generic versions |
| 28 | 26 | * of the builtin overflow checkers. Fortunately, clang implements |
| @@ -41,6 +39,3 @@ · 12 unmodified lines | ||
| 41 | 39 | * compilers, like ICC. |
| 42 | 40 | */ |
| 43 | 41 | #define barrier() __asm__ __volatile__("" : : : "memory") |
| 44 | −#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) | |
| 45 | −#define __assume_aligned(a, ...) \ | |
| 46 | − __attribute__((__assume_aligned__(a, ## __VA_ARGS__))) | |
| @@ -68,31 +68,20 @@ · 67 unmodified lines | ||
| 68 | 68 | */ |
| 69 | 69 | #define uninitialized_var(x) x = x |
| 70 | 70 | |
| 71 | −#ifdef __CHECKER__ | |
| 72 | −#define __must_be_array(a) 0 | |
| 73 | −#else | |
| 74 | −/* &a[0] degrades to a pointer: a different type from an array */ | |
| 75 | −#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) | |
| 76 | −#endif | |
| 77 | − | |
| 78 | 71 | #ifdef RETPOLINE |
| 79 | −#define __noretpoline __attribute__((indirect_branch("keep"))) | |
| 72 | +#define __noretpoline __attribute__((__indirect_branch__("keep"))) | |
| 80 | 73 | #endif |
| 81 | 74 | |
| 82 | 75 | #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) |
| 83 | 76 | |
| 84 | −#define __optimize(level) __attribute__((__optimize__(level))) | |
| 85 | − | |
| 86 | 77 | #define __compiletime_object_size(obj) __builtin_object_size(obj, 0) |
| 87 | 78 | |
| 88 | −#ifndef __CHECKER__ | |
| 89 | −#define __compiletime_warning(message) __attribute__((warning(message))) | |
| 90 | −#define __compiletime_error(message) __attribute__((error(message))) | |
| 79 | +#define __compiletime_warning(message) __attribute__((__warning__(message))) | |
| 80 | +#define __compiletime_error(message) __attribute__((__error__(message))) | |
| 91 | 81 | |
| 92 | −#ifdef LATENT_ENTROPY_PLUGIN | |
| 82 | +#if defined(LATENT_ENTROPY_PLUGIN) && !defined(__CHECKER__) | |
| 93 | 83 | #define __latent_entropy __attribute__((latent_entropy)) |
| 94 | 84 | #endif |
| 95 | −#endif /* __CHECKER__ */ | |
| 96 | 85 | |
| 97 | 86 | /* |
| 98 | 87 | * calling noreturn functions, __builtin_unreachable() and __builtin_trap() |
| @@ -107,10 +96,6 @@ · 8 unmodified lines | ||
| 107 | 96 | * Mark a position in code as unreachable. This can be used to |
| 108 | 97 | * suppress control flow warnings after asm blocks that transfer |
| 109 | 98 | * control elsewhere. |
| 110 | − * | |
| 111 | − * Early snapshots of gcc 4.5 don't support this and we can't detect | |
| 112 | − * this in the preprocessor, but we can live with this because they're | |
| 113 | − * unreleased. Really, we need to have autoconf for the kernel. | |
| 114 | 99 | */ |
| 115 | 100 | #define unreachable() \ |
| 116 | 101 | do { \ |
| @@ -119,9 +104,6 @@ · 2 unmodified lines | ||
| 119 | 104 | __builtin_unreachable(); \ |
| 120 | 105 | } while (0) |
| 121 | 106 | |
| 122 | −/* Mark a function definition as prohibited from being cloned. */ | |
| 123 | −#define __noclone __attribute__((__noclone__, __optimize__("no-tracer"))) | |
| 124 | − | |
| 125 | 107 | #if defined(RANDSTRUCT_PLUGIN) && !defined(__CHECKER__) |
| 126 | 108 | #define __randomize_layout __attribute__((randomize_layout)) |
| 127 | 109 | #define __no_randomize_layout __attribute__((no_randomize_layout)) |
| @@ -130,32 +112,6 @@ · 2 unmodified lines | ||
| 130 | 112 | #define randomized_struct_fields_end } __randomize_layout; |
| 131 | 113 | #endif |
| 132 | 114 | |
| 133 | −/* | |
| 134 | − * When used with Link Time Optimization, gcc can optimize away C functions or | |
| 135 | − * variables which are referenced only from assembly code. __visible tells the | |
| 136 | − * optimizer that something else uses this function or variable, thus preventing | |
| 137 | − * this. | |
| 138 | − */ | |
| 139 | −#define __visible __attribute__((externally_visible)) | |
| 140 | − | |
| 141 | −/* gcc version specific checks */ | |
| 142 | − | |
| 143 | −#if GCC_VERSION >= 40900 && !defined(__CHECKER__) | |
| 144 | −/* | |
| 145 | − * __assume_aligned(n, k): Tell the optimizer that the returned | |
| 146 | − * pointer can be assumed to be k modulo n. The second argument is | |
| 147 | − * optional (default 0), so we use a variadic macro to make the | |
| 148 | − * shorthand. | |
| 149 | − * | |
| 150 | − * Beware: Do not apply this to functions which may return | |
| 151 | − * ERR_PTRs. Also, it is probably unwise to apply it to functions | |
| 152 | − * returning extra information in the low bits (but in that case the | |
| 153 | − * compiler should see some alignment anyway, when the return value is | |
| 154 | − * massaged by 'flags = ptr & 3; ptr &= ~3;'). | |
| 155 | − */ | |
| 156 | −#define __assume_aligned(a, ...) __attribute__((__assume_aligned__(a, ## __VA_ARGS__))) | |
| 157 | −#endif | |
| 158 | − | |
| 159 | 115 | /* |
| 160 | 116 | * GCC 'asm goto' miscompiles certain code sequences: |
| 161 | 117 | * |
| @@ -187,39 +143,10 @@ · 25 unmodified lines | ||
| 187 | 143 | #define KASAN_ABI_VERSION 3 |
| 188 | 144 | #endif |
| 189 | 145 | |
| 190 | −#if GCC_VERSION >= 40902 | |
| 191 | −/* | |
| 192 | − * Tell the compiler that address safety instrumentation (KASAN) | |
| 193 | − * should not be applied to that function. | |
| 194 | − * Conflicts with inlining: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 | |
| 195 | − */ | |
| 196 | −#define __no_sanitize_address __attribute__((no_sanitize_address)) | |
| 197 | −#ifdef CONFIG_KASAN | |
| 198 | −#define __no_sanitize_address_or_inline \ | |
| 199 | − __no_sanitize_address __maybe_unused notrace | |
| 200 | −#else | |
| 201 | −#define __no_sanitize_address_or_inline inline | |
| 202 | −#endif | |
| 203 | −#endif | |
| 204 | − | |
| 205 | 146 | #if GCC_VERSION >= 50100 |
| 206 | −/* | |
| 207 | − * Mark structures as requiring designated initializers. | |
| 208 | − * https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html | |
| 209 | − */ | |
| 210 | −#define __designated_init __attribute__((designated_init)) | |
| 211 | 147 | #define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1 |
| 212 | 148 | #endif |
| 213 | 149 | |
| 214 | −#if !defined(__noclone) | |
| 215 | −#define __noclone /* not needed */ | |
| 216 | −#endif | |
| 217 | − | |
| 218 | −#if !defined(__no_sanitize_address) | |
| 219 | −#define __no_sanitize_address | |
| 220 | −#define __no_sanitize_address_or_inline inline | |
| 221 | −#endif | |
| 222 | − | |
| 223 | 150 | /* |
| 224 | 151 | * Turn individual warnings and errors on and off locally, depending |
| 225 | 152 | * on version. |
| @@ -29,17 +29,8 @@ · 28 unmodified lines | ||
| 29 | 29 | */ |
| 30 | 30 | #define OPTIMIZER_HIDE_VAR(var) barrier() |
| 31 | 31 | |
| 32 | −/* Intel ECC compiler doesn't support __builtin_types_compatible_p() */ | |
| 33 | −#define __must_be_array(a) 0 | |
| 34 | − | |
| 35 | 32 | #endif |
| 36 | 33 | |
| 37 | 34 | /* icc has this, but it's called _bswap16 */ |
| 38 | 35 | #define __HAVE_BUILTIN_BSWAP16__ |
| 39 | 36 | #define __builtin_bswap16 _bswap16 |
| 40 | − | |
| 41 | −/* The following are for compatibility with GCC, from compiler-gcc.h, | |
| 42 | − * and may be redefined here because they should not be shared with other | |
| 43 | − * compilers, like clang. | |
| 44 | − */ | |
| 45 | −#define __visible __attribute__((externally_visible)) | |
| @@ -23,8 +23,8 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, · 22 unmodified lines | ||
| 23 | 23 | #define __branch_check__(x, expect, is_constant) ({ \ |
| 24 | 24 | long ______r; \ |
| 25 | 25 | static struct ftrace_likely_data \ |
| 26 | − __attribute__((__aligned__(4))) \ | |
| 27 | − __attribute__((section("_ftrace_annotated_branch"))) \ | |
| 26 | + __aligned(4) \ | |
| 27 | + __section("_ftrace_annotated_branch") \ | |
| 28 | 28 | ______f = { \ |
| 29 | 29 | .data.func = __func__, \ |
| 30 | 30 | .data.file = __FILE__, \ |
| @@ -59,8 +59,8 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, · 28 unmodified lines | ||
| 59 | 59 | ({ \ |
| 60 | 60 | int ______r; \ |
| 61 | 61 | static struct ftrace_branch_data \ |
| 62 | − __attribute__((__aligned__(4))) \ | |
| 63 | − __attribute__((section("_ftrace_branch"))) \ | |
| 62 | + __aligned(4) \ | |
| 63 | + __section("_ftrace_branch") \ | |
| 64 | 64 | ______f = { \ |
| 65 | 65 | .func = __func__, \ |
| 66 | 66 | .file = __FILE__, \ |
| @@ -115,7 +115,10 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, · 48 unmodified lines | ||
| 115 | 115 | # define ASM_UNREACHABLE |
| 116 | 116 | #endif |
| 117 | 117 | #ifndef unreachable |
| 118 | −# define unreachable() do { annotate_reachable(); do { } while (1); } while (0) | |
| 118 | +# define unreachable() do { \ | |
| 119 | + annotate_unreachable(); \ | |
| 120 | + __builtin_unreachable(); \ | |
| 121 | +} while (0) | |
| 119 | 122 | #endif |
| 120 | 123 | |
| 121 | 124 | /* |
| @@ -137,7 +140,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val, · 15 unmodified lines | ||
| 137 | 140 | extern typeof(sym) sym; \ |
| 138 | 141 | static const unsigned long __kentry_##sym \ |
| 139 | 142 | __used \ |
| 140 | − __attribute__((section("___kentry" "+" #sym ), used)) \ | |
| 143 | + __section("___kentry" "+" #sym ) \ | |
| 141 | 144 | = (unsigned long)&sym; |
| 142 | 145 | #endif |
| 143 | 146 | |
| @@ -186,7 +189,7 @@ void __read_once_size(const volatile void *p, void *res, int size) · 42 unmodified lines | ||
| 186 | 189 | * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368 |
| 187 | 190 | * '__maybe_unused' allows us to avoid defined-but-not-used warnings. |
| 188 | 191 | */ |
| 189 | −# define __no_kasan_or_inline __no_sanitize_address __maybe_unused | |
| 192 | +# define __no_kasan_or_inline __no_sanitize_address notrace __maybe_unused | |
| 190 | 193 | #else |
| 191 | 194 | # define __no_kasan_or_inline __always_inline |
| 192 | 195 | #endif |
| @@ -278,7 +281,7 @@ unsigned long read_word_at_a_time(const void *addr) · 85 unmodified lines | ||
| 278 | 281 | * visible to the compiler. |
| 279 | 282 | */ |
| 280 | 283 | #define __ADDRESSABLE(sym) \ |
| 281 | − static void * __attribute__((section(".discard.addressable"), used)) \ | |
| 284 | + static void * __section(".discard.addressable") __used \ | |
| 282 | 285 | __PASTE(__addressable_##sym, __LINE__) = (void *)&sym; |
| 283 | 286 | |
| 284 | 287 | /** |
| @@ -331,10 +334,6 @@ static inline void *offset_to_ptr(const int *off) · 46 unmodified lines | ||
| 331 | 334 | #endif /* __KERNEL__ */ |
| 332 | 335 | #endif /* __ASSEMBLY__ */ |
| 333 | 336 | |
| 334 | −#ifndef __optimize | |
| 335 | −# define __optimize(level) | |
| 336 | −#endif | |
| 337 | − | |
| 338 | 337 | /* Compile time object size, -1 for unknown */ |
| 339 | 338 | #ifndef __compiletime_object_size |
| 340 | 339 | # define __compiletime_object_size(obj) -1 |
| @@ -376,4 +375,7 @@ static inline void *offset_to_ptr(const int *off) · 35 unmodified lines | ||
| 376 | 375 | compiletime_assert(__native_word(t), \ |
| 377 | 376 | "Need native word sized stores/loads for atomicity.") |
| 378 | 377 | |
| 378 | +/* &a[0] degrades to a pointer: a different type from an array */ | |
| 379 | +#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) | |
| 380 | + | |
| 379 | 381 | #endif /* __LINUX_COMPILER_H */ |
| @@ -0,0 +1,262 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef __LINUX_COMPILER_ATTRIBUTES_H | |
| 3 | +#define __LINUX_COMPILER_ATTRIBUTES_H | |
| 4 | + | |
| 5 | +/* | |
| 6 | + * The attributes in this file are unconditionally defined and they directly | |
| 7 | + * map to compiler attribute(s), unless one of the compilers does not support | |
| 8 | + * the attribute. In that case, __has_attribute is used to check for support | |
| 9 | + * and the reason is stated in its comment ("Optional: ..."). | |
| 10 | + * | |
| 11 | + * Any other "attributes" (i.e. those that depend on a configuration option, | |
| 12 | + * on a compiler, on an architecture, on plugins, on other attributes...) | |
| 13 | + * should be defined elsewhere (e.g. compiler_types.h or compiler-*.h). | |
| 14 | + * The intention is to keep this file as simple as possible, as well as | |
| 15 | + * compiler- and version-agnostic (e.g. avoiding GCC_VERSION checks). | |
| 16 | + * | |
| 17 | + * This file is meant to be sorted (by actual attribute name, | |
| 18 | + * not by #define identifier). Use the __attribute__((__name__)) syntax | |
| 19 | + * (i.e. with underscores) to avoid future collisions with other macros. | |
| 20 | + * Provide links to the documentation of each supported compiler, if it exists. | |
| 21 | + */ | |
| 22 | + | |
| 23 | +/* | |
| 24 | + * __has_attribute is supported on gcc >= 5, clang >= 2.9 and icc >= 17. | |
| 25 | + * In the meantime, to support 4.6 <= gcc < 5, we implement __has_attribute | |
| 26 | + * by hand. | |
| 27 | + * | |
| 28 | + * sparse does not support __has_attribute (yet) and defines __GNUC_MINOR__ | |
| 29 | + * depending on the compiler used to build it; however, these attributes have | |
| 30 | + * no semantic effects for sparse, so it does not matter. Also note that, | |
| 31 | + * in order to avoid sparse's warnings, even the unsupported ones must be | |
| 32 | + * defined to 0. | |
| 33 | + */ | |
| 34 | +#ifndef __has_attribute | |
| 35 | +# define __has_attribute(x) __GCC4_has_attribute_##x | |
| 36 | +# define __GCC4_has_attribute___assume_aligned__ (__GNUC_MINOR__ >= 9) | |
| 37 | +# define __GCC4_has_attribute___designated_init__ 0 | |
| 38 | +# define __GCC4_has_attribute___externally_visible__ 1 | |
| 39 | +# define __GCC4_has_attribute___noclone__ 1 | |
| 40 | +# define __GCC4_has_attribute___optimize__ 1 | |
| 41 | +# define __GCC4_has_attribute___nonstring__ 0 | |
| 42 | +# define __GCC4_has_attribute___no_sanitize_address__ (__GNUC_MINOR__ >= 8) | |
| 43 | +#endif | |
| 44 | + | |
| 45 | +/* | |
| 46 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-alias-function-attribute | |
| 47 | + */ | |
| 48 | +#define __alias(symbol) __attribute__((__alias__(#symbol))) | |
| 49 | + | |
| 50 | +/* | |
| 51 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-aligned-function-attribute | |
| 52 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-aligned-type-attribute | |
| 53 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-aligned-variable-attribute | |
| 54 | + */ | |
| 55 | +#define __aligned(x) __attribute__((__aligned__(x))) | |
| 56 | +#define __aligned_largest __attribute__((__aligned__)) | |
| 57 | + | |
| 58 | +/* | |
| 59 | + * Note: users of __always_inline currently do not write "inline" themselves, | |
| 60 | + * which seems to be required by gcc to apply the attribute according | |
| 61 | + * to its docs (and also "warning: always_inline function might not be | |
| 62 | + * inlinable [-Wattributes]" is emitted). | |
| 63 | + * | |
| 64 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-always_005finline-function-attribute | |
| 65 | + * clang: mentioned | |
| 66 | + */ | |
| 67 | +#define __always_inline inline __attribute__((__always_inline__)) | |
| 68 | + | |
| 69 | +/* | |
| 70 | + * The second argument is optional (default 0), so we use a variadic macro | |
| 71 | + * to make the shorthand. | |
| 72 | + * | |
| 73 | + * Beware: Do not apply this to functions which may return | |
| 74 | + * ERR_PTRs. Also, it is probably unwise to apply it to functions | |
| 75 | + * returning extra information in the low bits (but in that case the | |
| 76 | + * compiler should see some alignment anyway, when the return value is | |
| 77 | + * massaged by 'flags = ptr & 3; ptr &= ~3;'). | |
| 78 | + * | |
| 79 | + * Optional: only supported since gcc >= 4.9 | |
| 80 | + * Optional: not supported by icc | |
| 81 | + * | |
| 82 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-assume_005faligned-function-attribute | |
| 83 | + * clang: https://clang.llvm.org/docs/AttributeReference.html#assume-aligned | |
| 84 | + */ | |
| 85 | +#if __has_attribute(__assume_aligned__) | |
| 86 | +# define __assume_aligned(a, ...) __attribute__((__assume_aligned__(a, ## __VA_ARGS__))) | |
| 87 | +#else | |
| 88 | +# define __assume_aligned(a, ...) | |
| 89 | +#endif | |
| 90 | + | |
| 91 | +/* | |
| 92 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-cold-function-attribute | |
| 93 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Label-Attributes.html#index-cold-label-attribute | |
| 94 | + */ | |
| 95 | +#define __cold __attribute__((__cold__)) | |
| 96 | + | |
| 97 | +/* | |
| 98 | + * Note the long name. | |
| 99 | + * | |
| 100 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-const-function-attribute | |
| 101 | + */ | |
| 102 | +#define __attribute_const__ __attribute__((__const__)) | |
| 103 | + | |
| 104 | +/* | |
| 105 | + * Don't. Just don't. See commit 771c035372a0 ("deprecate the '__deprecated' | |
| 106 | + * attribute warnings entirely and for good") for more information. | |
| 107 | + * | |
| 108 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-deprecated-function-attribute | |
| 109 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-deprecated-type-attribute | |
| 110 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-deprecated-variable-attribute | |
| 111 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Enumerator-Attributes.html#index-deprecated-enumerator-attribute | |
| 112 | + * clang: https://clang.llvm.org/docs/AttributeReference.html#deprecated | |
| 113 | + */ | |
| 114 | +#define __deprecated | |
| 115 | + | |
| 116 | +/* | |
| 117 | + * Optional: only supported since gcc >= 5.1 | |
| 118 | + * Optional: not supported by clang | |
| 119 | + * Optional: not supported by icc | |
| 120 | + * | |
| 121 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-designated_005finit-type-attribute | |
| 122 | + */ | |
| 123 | +#if __has_attribute(__designated_init__) | |
| 124 | +# define __designated_init __attribute__((__designated_init__)) | |
| 125 | +#else | |
| 126 | +# define __designated_init | |
| 127 | +#endif | |
| 128 | + | |
| 129 | +/* | |
| 130 | + * Optional: not supported by clang | |
| 131 | + * | |
| 132 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-externally_005fvisible-function-attribute | |
| 133 | + */ | |
| 134 | +#if __has_attribute(__externally_visible__) | |
| 135 | +# define __visible __attribute__((__externally_visible__)) | |
| 136 | +#else | |
| 137 | +# define __visible | |
| 138 | +#endif | |
| 139 | + | |
| 140 | +/* | |
| 141 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-format-function-attribute | |
| 142 | + * clang: https://clang.llvm.org/docs/AttributeReference.html#format | |
| 143 | + */ | |
| 144 | +#define __printf(a, b) __attribute__((__format__(printf, a, b))) | |
| 145 | +#define __scanf(a, b) __attribute__((__format__(scanf, a, b))) | |
| 146 | + | |
| 147 | +/* | |
| 148 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-gnu_005finline-function-attribute | |
| 149 | + * clang: https://clang.llvm.org/docs/AttributeReference.html#gnu-inline | |
| 150 | + */ | |
| 151 | +#define __gnu_inline __attribute__((__gnu_inline__)) | |
| 152 | + | |
| 153 | +/* | |
| 154 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-malloc-function-attribute | |
| 155 | + */ | |
| 156 | +#define __malloc __attribute__((__malloc__)) | |
| 157 | + | |
| 158 | +/* | |
| 159 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-mode-type-attribute | |
| 160 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-mode-variable-attribute | |
| 161 | + */ | |
| 162 | +#define __mode(x) __attribute__((__mode__(x))) | |
| 163 | + | |
| 164 | +/* | |
| 165 | + * Optional: not supported by clang | |
| 166 | + * Note: icc does not recognize gcc's no-tracer | |
| 167 | + * | |
| 168 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noclone-function-attribute | |
| 169 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-optimize-function-attribute | |
| 170 | + */ | |
| 171 | +#if __has_attribute(__noclone__) | |
| 172 | +# if __has_attribute(__optimize__) | |
| 173 | +# define __noclone __attribute__((__noclone__, __optimize__("no-tracer"))) | |
| 174 | +# else | |
| 175 | +# define __noclone __attribute__((__noclone__)) | |
| 176 | +# endif | |
| 177 | +#else | |
| 178 | +# define __noclone | |
| 179 | +#endif | |
| 180 | + | |
| 181 | +/* | |
| 182 | + * Note the missing underscores. | |
| 183 | + * | |
| 184 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noinline-function-attribute | |
| 185 | + * clang: mentioned | |
| 186 | + */ | |
| 187 | +#define noinline __attribute__((__noinline__)) | |
| 188 | + | |
| 189 | +/* | |
| 190 | + * Optional: only supported since gcc >= 8 | |
| 191 | + * Optional: not supported by clang | |
| 192 | + * Optional: not supported by icc | |
| 193 | + * | |
| 194 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-nonstring-variable-attribute | |
| 195 | + */ | |
| 196 | +#if __has_attribute(__nonstring__) | |
| 197 | +# define __nonstring __attribute__((__nonstring__)) | |
| 198 | +#else | |
| 199 | +# define __nonstring | |
| 200 | +#endif | |
| 201 | + | |
| 202 | +/* | |
| 203 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noreturn-function-attribute | |
| 204 | + * clang: https://clang.llvm.org/docs/AttributeReference.html#noreturn | |
| 205 | + * clang: https://clang.llvm.org/docs/AttributeReference.html#id1 | |
| 206 | + */ | |
| 207 | +#define __noreturn __attribute__((__noreturn__)) | |
| 208 | + | |
| 209 | +/* | |
| 210 | + * Optional: only supported since gcc >= 4.8 | |
| 211 | + * Optional: not supported by icc | |
| 212 | + * | |
| 213 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-no_005fsanitize_005faddress-function-attribute | |
| 214 | + * clang: https://clang.llvm.org/docs/AttributeReference.html#no-sanitize-address-no-address-safety-analysis | |
| 215 | + */ | |
| 216 | +#if __has_attribute(__no_sanitize_address__) | |
| 217 | +# define __no_sanitize_address __attribute__((__no_sanitize_address__)) | |
| 218 | +#else | |
| 219 | +# define __no_sanitize_address | |
| 220 | +#endif | |
| 221 | + | |
| 222 | +/* | |
| 223 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-packed-type-attribute | |
| 224 | + * clang: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-packed-variable-attribute | |
| 225 | + */ | |
| 226 | +#define __packed __attribute__((__packed__)) | |
| 227 | + | |
| 228 | +/* | |
| 229 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-pure-function-attribute | |
| 230 | + */ | |
| 231 | +#define __pure __attribute__((__pure__)) | |
| 232 | + | |
| 233 | +/* | |
| 234 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-section-function-attribute | |
| 235 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-section-variable-attribute | |
| 236 | + * clang: https://clang.llvm.org/docs/AttributeReference.html#section-declspec-allocate | |
| 237 | + */ | |
| 238 | +#define __section(S) __attribute__((__section__(#S))) | |
| 239 | + | |
| 240 | +/* | |
| 241 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-unused-function-attribute | |
| 242 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-unused-type-attribute | |
| 243 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-unused-variable-attribute | |
| 244 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Label-Attributes.html#index-unused-label-attribute | |
| 245 | + * clang: https://clang.llvm.org/docs/AttributeReference.html#maybe-unused-unused | |
| 246 | + */ | |
| 247 | +#define __always_unused __attribute__((__unused__)) | |
| 248 | +#define __maybe_unused __attribute__((__unused__)) | |
| 249 | + | |
| 250 | +/* | |
| 251 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-used-function-attribute | |
| 252 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-used-variable-attribute | |
| 253 | + */ | |
| 254 | +#define __used __attribute__((__used__)) | |
| 255 | + | |
| 256 | +/* | |
| 257 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-weak-function-attribute | |
| 258 | + * gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-weak-variable-attribute | |
| 259 | + */ | |
| 260 | +#define __weak __attribute__((__weak__)) | |
| 261 | + | |
| 262 | +#endif /* __LINUX_COMPILER_ATTRIBUTES_H */ | |
| @@ -1,3 +1,4 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 1 | 2 | #ifndef __LINUX_COMPILER_TYPES_H |
| 2 | 3 | #define __LINUX_COMPILER_TYPES_H |
| 3 | 4 | |
| @@ -54,6 +55,9 @@ extern void __chk_io_ptr(const volatile void __iomem *); · 50 unmodified lines | ||
| 54 | 55 | |
| 55 | 56 | #ifdef __KERNEL__ |
| 56 | 57 | |
| 58 | +/* Attributes */ | |
| 59 | +#include <linux/compiler_attributes.h> | |
| 60 | + | |
| 57 | 61 | /* Compiler specific macros. */ |
| 58 | 62 | #ifdef __clang__ |
| 59 | 63 | #include <linux/compiler-clang.h> |
| @@ -78,12 +82,6 @@ extern void __chk_io_ptr(const volatile void __iomem *); · 18 unmodified lines | ||
| 78 | 82 | #include <asm/compiler.h> |
| 79 | 83 | #endif |
| 80 | 84 | |
| 81 | −/* | |
| 82 | − * Generic compiler-independent macros required for kernel | |
| 83 | − * build go below this comment. Actual compiler/compiler version | |
| 84 | − * specific implementations come from the above header files | |
| 85 | − */ | |
| 86 | − | |
| 87 | 85 | struct ftrace_branch_data { |
| 88 | 86 | const char *func; |
| 89 | 87 | const char *file; |
| @@ -106,10 +104,6 @@ struct ftrace_likely_data { · 16 unmodified lines | ||
| 106 | 104 | unsigned long constant; |
| 107 | 105 | }; |
| 108 | 106 | |
| 109 | −/* Don't. Just don't. */ | |
| 110 | −#define __deprecated | |
| 111 | −#define __deprecated_for_modules | |
| 112 | − | |
| 113 | 107 | #endif /* __KERNEL__ */ |
| 114 | 108 | |
| 115 | 109 | #endif /* __ASSEMBLY__ */ |
| @@ -119,10 +113,6 @@ struct ftrace_likely_data { · 3 unmodified lines | ||
| 119 | 113 | * compilers. We don't consider that to be an error, so set them to nothing. |
| 120 | 114 | * For example, some of them are for compiler specific plugins. |
| 121 | 115 | */ |
| 122 | −#ifndef __designated_init | |
| 123 | −# define __designated_init | |
| 124 | −#endif | |
| 125 | − | |
| 126 | 116 | #ifndef __latent_entropy |
| 127 | 117 | # define __latent_entropy |
| 128 | 118 | #endif |
| @@ -140,15 +130,8 @@ struct ftrace_likely_data { · 11 unmodified lines | ||
| 140 | 130 | # define randomized_struct_fields_end |
| 141 | 131 | #endif |
| 142 | 132 | |
| 143 | −#ifndef __visible | |
| 144 | −#define __visible | |
| 145 | −#endif | |
| 146 | − | |
| 147 | −/* | |
| 148 | − * Assume alignment of return value. | |
| 149 | − */ | |
| 150 | −#ifndef __assume_aligned | |
| 151 | −#define __assume_aligned(a, ...) | |
| 133 | +#ifndef asm_volatile_goto | |
| 134 | +#define asm_volatile_goto(x...) asm goto(x) | |
| 152 | 135 | #endif |
| 153 | 136 | |
| 154 | 137 | /* Are two types/vars the same type (ignoring qualifiers)? */ |
| @@ -159,14 +142,6 @@ struct ftrace_likely_data { · 4 unmodified lines | ||
| 159 | 142 | (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \ |
| 160 | 143 | sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) |
| 161 | 144 | |
| 162 | −#ifndef __attribute_const__ | |
| 163 | −#define __attribute_const__ __attribute__((__const__)) | |
| 164 | −#endif | |
| 165 | − | |
| 166 | −#ifndef __noclone | |
| 167 | −#define __noclone | |
| 168 | −#endif | |
| 169 | − | |
| 170 | 145 | /* Helpers for emitting diagnostics in pragmas. */ |
| 171 | 146 | #ifndef __diag |
| 172 | 147 | #define __diag(string) |
| @@ -186,43 +161,16 @@ struct ftrace_likely_data { · 13 unmodified lines | ||
| 186 | 161 | #define __diag_error(compiler, version, option, comment) \ |
| 187 | 162 | __diag_ ## compiler(version, error, option) |
| 188 | 163 | |
| 189 | −/* | |
| 190 | − * From the GCC manual: | |
| 191 | − * | |
| 192 | − * Many functions have no effects except the return value and their | |
| 193 | − * return value depends only on the parameters and/or global | |
| 194 | − * variables. Such a function can be subject to common subexpression | |
| 195 | − * elimination and loop optimization just as an arithmetic operator | |
| 196 | − * would be. | |
| 197 | − * [...] | |
| 198 | − */ | |
| 199 | −#define __pure __attribute__((pure)) | |
| 200 | −#define __aligned(x) __attribute__((aligned(x))) | |
| 201 | −#define __printf(a, b) __attribute__((format(printf, a, b))) | |
| 202 | −#define __scanf(a, b) __attribute__((format(scanf, a, b))) | |
| 203 | −#define __maybe_unused __attribute__((unused)) | |
| 204 | −#define __always_unused __attribute__((unused)) | |
| 205 | −#define __mode(x) __attribute__((mode(x))) | |
| 206 | −#define __malloc __attribute__((__malloc__)) | |
| 207 | −#define __used __attribute__((__used__)) | |
| 208 | −#define __noreturn __attribute__((noreturn)) | |
| 209 | −#define __packed __attribute__((packed)) | |
| 210 | −#define __weak __attribute__((weak)) | |
| 211 | −#define __alias(symbol) __attribute__((alias(#symbol))) | |
| 212 | −#define __cold __attribute__((cold)) | |
| 213 | −#define __section(S) __attribute__((__section__(#S))) | |
| 214 | − | |
| 215 | − | |
| 216 | 164 | #ifdef CONFIG_ENABLE_MUST_CHECK |
| 217 | −#define __must_check __attribute__((warn_unused_result)) | |
| 165 | +#define __must_check __attribute__((__warn_unused_result__)) | |
| 218 | 166 | #else |
| 219 | 167 | #define __must_check |
| 220 | 168 | #endif |
| 221 | 169 | |
| 222 | −#if defined(CC_USING_HOTPATCH) && !defined(__CHECKER__) | |
| 170 | +#if defined(CC_USING_HOTPATCH) | |
| 223 | 171 | #define notrace __attribute__((hotpatch(0, 0))) |
| 224 | 172 | #else |
| 225 | −#define notrace __attribute__((no_instrument_function)) | |
| 173 | +#define notrace __attribute__((__no_instrument_function__)) | |
| 226 | 174 | #endif |
| 227 | 175 | |
| 228 | 176 | /* |
| @@ -231,22 +179,10 @@ struct ftrace_likely_data { · 2 unmodified lines | ||
| 231 | 179 | * stack and frame pointer being set up and there is no chance to |
| 232 | 180 | * restore the lr register to the value before mcount was called. |
| 233 | 181 | */ |
| 234 | −#define __naked __attribute__((naked)) notrace | |
| 182 | +#define __naked __attribute__((__naked__)) notrace | |
| 235 | 183 | |
| 236 | 184 | #define __compiler_offsetof(a, b) __builtin_offsetof(a, b) |
| 237 | 185 | |
| 238 | −/* | |
| 239 | − * Feature detection for gnu_inline (gnu89 extern inline semantics). Either | |
| 240 | − * __GNUC_STDC_INLINE__ is defined (not using gnu89 extern inline semantics, | |
| 241 | − * and we opt in to the gnu89 semantics), or __GNUC_STDC_INLINE__ is not | |
| 242 | − * defined so the gnu89 semantics are the default. | |
| 243 | − */ | |
| 244 | −#ifdef __GNUC_STDC_INLINE__ | |
| 245 | −# define __gnu_inline __attribute__((gnu_inline)) | |
| 246 | −#else | |
| 247 | −# define __gnu_inline | |
| 248 | −#endif | |
| 249 | − | |
| 250 | 186 | /* |
| 251 | 187 | * Force always-inline if the user requests it so via the .config. |
| 252 | 188 | * GCC does not warn about unused static inline functions for |
| @@ -258,22 +194,20 @@ struct ftrace_likely_data { · 5 unmodified lines | ||
| 258 | 194 | * semantics rather than c99. This prevents multiple symbol definition errors |
| 259 | 195 | * of extern inline functions at link time. |
| 260 | 196 | * A lot of inline functions can cause havoc with function tracing. |
| 197 | + * Do not use __always_inline here, since currently it expands to inline again | |
| 198 | + * (which would break users of __always_inline). | |
| 261 | 199 | */ |
| 262 | 200 | #if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ |
| 263 | 201 | !defined(CONFIG_OPTIMIZE_INLINING) |
| 264 | −#define inline \ | |
| 265 | − inline __attribute__((always_inline, unused)) notrace __gnu_inline | |
| 202 | +#define inline inline __attribute__((__always_inline__)) __gnu_inline \ | |
| 203 | + __maybe_unused notrace | |
| 266 | 204 | #else |
| 267 | −#define inline inline __attribute__((unused)) notrace __gnu_inline | |
| 205 | +#define inline inline __gnu_inline \ | |
| 206 | + __maybe_unused notrace | |
| 268 | 207 | #endif |
| 269 | 208 | |
| 270 | 209 | #define __inline__ inline |
| 271 | −#define __inline inline | |
| 272 | −#define noinline __attribute__((noinline)) | |
| 273 | − | |
| 274 | −#ifndef __always_inline | |
| 275 | −#define __always_inline inline __attribute__((always_inline)) | |
| 276 | −#endif | |
| 210 | +#define __inline inline | |
| 277 | 211 | |
| 278 | 212 | /* |
| 279 | 213 | * Rather then using noinline to prevent stack consumption, use |
| @@ -126,6 +126,7 @@ enum cpuhp_state { · 125 unmodified lines | ||
| 126 | 126 | CPUHP_AP_MIPS_GIC_TIMER_STARTING, |
| 127 | 127 | CPUHP_AP_ARC_TIMER_STARTING, |
| 128 | 128 | CPUHP_AP_RISCV_TIMER_STARTING, |
| 129 | + CPUHP_AP_CSKY_TIMER_STARTING, | |
| 129 | 130 | CPUHP_AP_KVM_STARTING, |
| 130 | 131 | CPUHP_AP_KVM_ARM_VGIC_INIT_STARTING, |
| 131 | 132 | CPUHP_AP_KVM_ARM_VGIC_STARTING, |
| @@ -7,6 +7,8 @@ · 6 unmodified lines | ||
| 7 | 7 | #include <linux/radix-tree.h> |
| 8 | 8 | #include <asm/pgtable.h> |
| 9 | 9 | |
| 10 | +typedef unsigned long dax_entry_t; | |
| 11 | + | |
| 10 | 12 | struct iomap_ops; |
| 11 | 13 | struct dax_device; |
| 12 | 14 | struct dax_operations { |
| @@ -88,8 +90,8 @@ int dax_writeback_mapping_range(struct address_space *mapping, · 75 unmodified lines | ||
| 88 | 90 | struct block_device *bdev, struct writeback_control *wbc); |
| 89 | 91 | |
| 90 | 92 | struct page *dax_layout_busy_page(struct address_space *mapping); |
| 91 | −bool dax_lock_mapping_entry(struct page *page); | |
| 92 | −void dax_unlock_mapping_entry(struct page *page); | |
| 93 | +dax_entry_t dax_lock_page(struct page *page); | |
| 94 | +void dax_unlock_page(struct page *page, dax_entry_t cookie); | |
| 93 | 95 | #else |
| 94 | 96 | static inline bool bdev_dax_supported(struct block_device *bdev, |
| 95 | 97 | int blocksize) |
| @@ -122,14 +124,14 @@ static inline int dax_writeback_mapping_range(struct address_space *mapping, · 26 unmodified lines | ||
| 122 | 124 | return -EOPNOTSUPP; |
| 123 | 125 | } |
| 124 | 126 | |
| 125 | −static inline bool dax_lock_mapping_entry(struct page *page) | |
| 127 | +static inline dax_entry_t dax_lock_page(struct page *page) | |
| 126 | 128 | { |
| 127 | 129 | if (IS_DAX(page->mapping->host)) |
| 128 | − return true; | |
| 129 | − return false; | |
| 130 | + return ~0UL; | |
| 131 | + return 0; | |
| 130 | 132 | } |
| 131 | 133 | |
| 132 | −static inline void dax_unlock_mapping_entry(struct page *page) | |
| 134 | +static inline void dax_unlock_page(struct page *page, dax_entry_t cookie) | |
| 133 | 135 | { |
| 134 | 136 | } |
| 135 | 137 | #endif |
| @@ -5,7 +5,7 @@ · 4 unmodified lines | ||
| 5 | 5 | #include <linux/dma-mapping.h> |
| 6 | 6 | #include <linux/mem_encrypt.h> |
| 7 | 7 | |
| 8 | −#define DIRECT_MAPPING_ERROR 0 | |
| 8 | +#define DIRECT_MAPPING_ERROR (~(dma_addr_t)0) | |
| 9 | 9 | |
| 10 | 10 | #ifdef CONFIG_ARCH_HAS_PHYS_TO_DMA |
| 11 | 11 | #include <asm/dma-direct.h> |
| @@ -1167,6 +1167,8 @@ static inline bool efi_enabled(int feature) · 1166 unmodified lines | ||
| 1167 | 1167 | extern void efi_reboot(enum reboot_mode reboot_mode, const char *__unused); |
| 1168 | 1168 | |
| 1169 | 1169 | extern bool efi_is_table_address(unsigned long phys_addr); |
| 1170 | + | |
| 1171 | +extern int efi_apply_persistent_mem_reservations(void); | |
| 1170 | 1172 | #else |
| 1171 | 1173 | static inline bool efi_enabled(int feature) |
| 1172 | 1174 | { |
| @@ -1185,6 +1187,11 @@ static inline bool efi_is_table_address(unsigned long phys_addr) · 12 unmodified lines | ||
| 1185 | 1187 | { |
| 1186 | 1188 | return false; |
| 1187 | 1189 | } |
| 1190 | + | |
| 1191 | +static inline int efi_apply_persistent_mem_reservations(void) | |
| 1192 | +{ | |
| 1193 | + return 0; | |
| 1194 | +} | |
| 1188 | 1195 | #endif |
| 1189 | 1196 | |
| 1190 | 1197 | extern int efi_status_to_err(efi_status_t status); |
| @@ -449,6 +449,13 @@ struct sock_reuseport; · 448 unmodified lines | ||
| 449 | 449 | offsetof(TYPE, MEMBER) ... offsetofend(TYPE, MEMBER) - 1 |
| 450 | 450 | #define bpf_ctx_range_till(TYPE, MEMBER1, MEMBER2) \ |
| 451 | 451 | offsetof(TYPE, MEMBER1) ... offsetofend(TYPE, MEMBER2) - 1 |
| 452 | +#if BITS_PER_LONG == 64 | |
| 453 | +# define bpf_ctx_range_ptr(TYPE, MEMBER) \ | |
| 454 | + offsetof(TYPE, MEMBER) ... offsetofend(TYPE, MEMBER) - 1 | |
| 455 | +#else | |
| 456 | +# define bpf_ctx_range_ptr(TYPE, MEMBER) \ | |
| 457 | + offsetof(TYPE, MEMBER) ... offsetof(TYPE, MEMBER) + 8 - 1 | |
| 458 | +#endif /* BITS_PER_LONG == 64 */ | |
| 452 | 459 | |
| 453 | 460 | #define bpf_target_off(TYPE, MEMBER, SIZE, PTR_SIZE) \ |
| 454 | 461 | ({ \ |
| @@ -866,6 +873,10 @@ void bpf_jit_binary_free(struct bpf_binary_header *hdr); · 411 unmodified lines | ||
| 866 | 873 | |
| 867 | 874 | void bpf_jit_free(struct bpf_prog *fp); |
| 868 | 875 | |
| 876 | +int bpf_jit_get_func_addr(const struct bpf_prog *prog, | |
| 877 | + const struct bpf_insn *insn, bool extra_pass, | |
| 878 | + u64 *func_addr, bool *func_addr_fixed); | |
| 879 | + | |
| 869 | 880 | struct bpf_prog *bpf_jit_blind_constants(struct bpf_prog *fp); |
| 870 | 881 | void bpf_jit_prog_release_other(struct bpf_prog *fp, struct bpf_prog *fp_other); |
| 871 | 882 | |
| @@ -1752,6 +1752,25 @@ struct block_device_operations; · 1751 unmodified lines | ||
| 1752 | 1752 | #define NOMMU_VMFLAGS \ |
| 1753 | 1753 | (NOMMU_MAP_READ | NOMMU_MAP_WRITE | NOMMU_MAP_EXEC) |
| 1754 | 1754 | |
| 1755 | +/* | |
| 1756 | + * These flags control the behavior of the remap_file_range function pointer. | |
| 1757 | + * If it is called with len == 0 that means "remap to end of source file". | |
| 1758 | + * See Documentation/filesystems/vfs.txt for more details about this call. | |
| 1759 | + * | |
| 1760 | + * REMAP_FILE_DEDUP: only remap if contents identical (i.e. deduplicate) | |
| 1761 | + * REMAP_FILE_CAN_SHORTEN: caller can handle a shortened request | |
| 1762 | + */ | |
| 1763 | +#define REMAP_FILE_DEDUP (1 << 0) | |
| 1764 | +#define REMAP_FILE_CAN_SHORTEN (1 << 1) | |
| 1765 | + | |
| 1766 | +/* | |
| 1767 | + * These flags signal that the caller is ok with altering various aspects of | |
| 1768 | + * the behavior of the remap operation. The changes must be made by the | |
| 1769 | + * implementation; the vfs remap helper functions can take advantage of them. | |
| 1770 | + * Flags in this category exist to preserve the quirky behavior of the hoisted | |
| 1771 | + * btrfs clone/dedupe ioctls. | |
| 1772 | + */ | |
| 1773 | +#define REMAP_FILE_ADVISORY (REMAP_FILE_CAN_SHORTEN) | |
| 1755 | 1774 | |
| 1756 | 1775 | struct iov_iter; |
| 1757 | 1776 | |
| @@ -1790,10 +1809,9 @@ struct file_operations { · 32 unmodified lines | ||
| 1790 | 1809 | #endif |
| 1791 | 1810 | ssize_t (*copy_file_range)(struct file *, loff_t, struct file *, |
| 1792 | 1811 | loff_t, size_t, unsigned int); |
| 1793 | − int (*clone_file_range)(struct file *, loff_t, struct file *, loff_t, | |
| 1794 | − u64); | |
| 1795 | − int (*dedupe_file_range)(struct file *, loff_t, struct file *, loff_t, | |
| 1796 | − u64); | |
| 1812 | + loff_t (*remap_file_range)(struct file *file_in, loff_t pos_in, | |
| 1813 | + struct file *file_out, loff_t pos_out, | |
| 1814 | + loff_t len, unsigned int remap_flags); | |
| 1797 | 1815 | int (*fadvise)(struct file *, loff_t, loff_t, int); |
| 1798 | 1816 | } __randomize_layout; |
| 1799 | 1817 | |
| @@ -1856,21 +1874,21 @@ extern ssize_t vfs_readv(struct file *, const struct iovec __user *, · 56 unmodified lines | ||
| 1856 | 1874 | unsigned long, loff_t *, rwf_t); |
| 1857 | 1875 | extern ssize_t vfs_copy_file_range(struct file *, loff_t , struct file *, |
| 1858 | 1876 | loff_t, size_t, unsigned int); |
| 1859 | −extern int vfs_clone_file_prep_inodes(struct inode *inode_in, loff_t pos_in, | |
| 1860 | − struct inode *inode_out, loff_t pos_out, | |
| 1861 | − u64 *len, bool is_dedupe); | |
| 1862 | −extern int do_clone_file_range(struct file *file_in, loff_t pos_in, | |
| 1863 | − struct file *file_out, loff_t pos_out, u64 len); | |
| 1864 | −extern int vfs_clone_file_range(struct file *file_in, loff_t pos_in, | |
| 1865 | − struct file *file_out, loff_t pos_out, u64 len); | |
| 1866 | −extern int vfs_dedupe_file_range_compare(struct inode *src, loff_t srcoff, | |
| 1867 | − struct inode *dest, loff_t destoff, | |
| 1868 | − loff_t len, bool *is_same); | |
| 1877 | +extern int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in, | |
| 1878 | + struct file *file_out, loff_t pos_out, | |
| 1879 | + loff_t *count, | |
| 1880 | + unsigned int remap_flags); | |
| 1881 | +extern loff_t do_clone_file_range(struct file *file_in, loff_t pos_in, | |
| 1882 | + struct file *file_out, loff_t pos_out, | |
| 1883 | + loff_t len, unsigned int remap_flags); | |
| 1884 | +extern loff_t vfs_clone_file_range(struct file *file_in, loff_t pos_in, | |
| 1885 | + struct file *file_out, loff_t pos_out, | |
| 1886 | + loff_t len, unsigned int remap_flags); | |
| 1869 | 1887 | extern int vfs_dedupe_file_range(struct file *file, |
| 1870 | 1888 | struct file_dedupe_range *same); |
| 1871 | −extern int vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos, | |
| 1872 | − struct file *dst_file, loff_t dst_pos, | |
| 1873 | − u64 len); | |
| 1889 | +extern loff_t vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos, | |
| 1890 | + struct file *dst_file, loff_t dst_pos, | |
| 1891 | + loff_t len, unsigned int remap_flags); | |
| 1874 | 1892 | |
| 1875 | 1893 | |
| 1876 | 1894 | struct super_operations { |
| @@ -2998,6 +3016,9 @@ extern int sb_min_blocksize(struct super_block *, int); · 1121 unmodified lines | ||
| 2998 | 3016 | extern int generic_file_mmap(struct file *, struct vm_area_struct *); |
| 2999 | 3017 | extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *); |
| 3000 | 3018 | extern ssize_t generic_write_checks(struct kiocb *, struct iov_iter *); |
| 3019 | +extern int generic_remap_checks(struct file *file_in, loff_t pos_in, | |
| 3020 | + struct file *file_out, loff_t pos_out, | |
| 3021 | + loff_t *count, unsigned int remap_flags); | |
| 3001 | 3022 | extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *); |
| 3002 | 3023 | extern ssize_t __generic_file_write_iter(struct kiocb *, struct iov_iter *); |
| 3003 | 3024 | extern ssize_t generic_file_write_iter(struct kiocb *, struct iov_iter *); |
| @@ -196,8 +196,7 @@ static inline void fscache_enqueue_retrieval(struct fscache_retrieval *op) · 195 unmodified lines | ||
| 196 | 196 | static inline void fscache_retrieval_complete(struct fscache_retrieval *op, |
| 197 | 197 | int n_pages) |
| 198 | 198 | { |
| 199 | − atomic_sub(n_pages, &op->n_pages); | |
| 200 | − if (atomic_read(&op->n_pages) <= 0) | |
| 199 | + if (atomic_sub_return_relaxed(n_pages, &op->n_pages) <= 0) | |
| 201 | 200 | fscache_op_complete(&op->op, false); |
| 202 | 201 | } |
| 203 | 202 | |
| @@ -777,8 +777,8 @@ struct ftrace_ret_stack { · 776 unmodified lines | ||
| 777 | 777 | extern void return_to_handler(void); |
| 778 | 778 | |
| 779 | 779 | extern int |
| 780 | −ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth, | |
| 781 | − unsigned long frame_pointer, unsigned long *retp); | |
| 780 | +function_graph_enter(unsigned long ret, unsigned long func, | |
| 781 | + unsigned long frame_pointer, unsigned long *retp); | |
| 782 | 782 | |
| 783 | 783 | unsigned long ftrace_graph_ret_addr(struct task_struct *task, int *idx, |
| 784 | 784 | unsigned long ret, unsigned long *retp); |
| @@ -511,14 +511,14 @@ alloc_pages(gfp_t gfp_mask, unsigned int order) · 510 unmodified lines | ||
| 511 | 511 | extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order, |
| 512 | 512 | struct vm_area_struct *vma, unsigned long addr, |
| 513 | 513 | int node, bool hugepage); |
| 514 | −#define alloc_hugepage_vma(gfp_mask, vma, addr, order) \ | |
| 514 | +#define alloc_hugepage_vma(gfp_mask, vma, addr, order) \ | |
| 515 | 515 | alloc_pages_vma(gfp_mask, order, vma, addr, numa_node_id(), true) |
| 516 | 516 | #else |
| 517 | 517 | #define alloc_pages(gfp_mask, order) \ |
| 518 | 518 | alloc_pages_node(numa_node_id(), gfp_mask, order) |
| 519 | 519 | #define alloc_pages_vma(gfp_mask, order, vma, addr, node, false)\ |
| 520 | 520 | alloc_pages(gfp_mask, order) |
| 521 | −#define alloc_hugepage_vma(gfp_mask, vma, addr, order) \ | |
| 521 | +#define alloc_hugepage_vma(gfp_mask, vma, addr, order) \ | |
| 522 | 522 | alloc_pages(gfp_mask, order) |
| 523 | 523 | #endif |
| 524 | 524 | #define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) |
| @@ -177,6 +177,7 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev, · 176 unmodified lines | ||
| 177 | 177 | * @attr_usage_id: Attribute usage id as per spec |
| 178 | 178 | * @report_id: Report id to look for |
| 179 | 179 | * @flag: Synchronous or asynchronous read |
| 180 | +* @is_signed: If true then fields < 32 bits will be sign-extended | |
| 180 | 181 | * |
| 181 | 182 | * Issues a synchronous or asynchronous read request for an input attribute. |
| 182 | 183 | * Returns data upto 32 bits. |
| @@ -190,7 +191,8 @@ enum sensor_hub_read_flags { · 7 unmodified lines | ||
| 190 | 191 | int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev, |
| 191 | 192 | u32 usage_id, |
| 192 | 193 | u32 attr_usage_id, u32 report_id, |
| 193 | − enum sensor_hub_read_flags flag | |
| 194 | + enum sensor_hub_read_flags flag, | |
| 195 | + bool is_signed | |
| 194 | 196 | ); |
| 195 | 197 | |
| 196 | 198 | /** |
| @@ -219,6 +219,7 @@ struct hid_item { · 218 unmodified lines | ||
| 219 | 219 | #define HID_GD_VBRZ 0x00010045 |
| 220 | 220 | #define HID_GD_VNO 0x00010046 |
| 221 | 221 | #define HID_GD_FEATURE 0x00010047 |
| 222 | +#define HID_GD_RESOLUTION_MULTIPLIER 0x00010048 | |
| 222 | 223 | #define HID_GD_SYSTEM_CONTROL 0x00010080 |
| 223 | 224 | #define HID_GD_UP 0x00010090 |
| 224 | 225 | #define HID_GD_DOWN 0x00010091 |
| @@ -232,12 +233,14 @@ struct hid_item { · 7 unmodified lines | ||
| 232 | 233 | #define HID_DC_BATTERYSTRENGTH 0x00060020 |
| 233 | 234 | |
| 234 | 235 | #define HID_CP_CONSUMER_CONTROL 0x000c0001 |
| 236 | +#define HID_CP_AC_PAN 0x000c0238 | |
| 235 | 237 | |
| 236 | 238 | #define HID_DG_DIGITIZER 0x000d0001 |
| 237 | 239 | #define HID_DG_PEN 0x000d0002 |
| 238 | 240 | #define HID_DG_LIGHTPEN 0x000d0003 |
| 239 | 241 | #define HID_DG_TOUCHSCREEN 0x000d0004 |
| 240 | 242 | #define HID_DG_TOUCHPAD 0x000d0005 |
| 243 | +#define HID_DG_WHITEBOARD 0x000d0006 | |
| 241 | 244 | #define HID_DG_STYLUS 0x000d0020 |
| 242 | 245 | #define HID_DG_PUCK 0x000d0021 |
| 243 | 246 | #define HID_DG_FINGER 0x000d0022 |
| @@ -427,6 +430,7 @@ struct hid_local { · 183 unmodified lines | ||
| 427 | 430 | */ |
| 428 | 431 | |
| 429 | 432 | struct hid_collection { |
| 433 | + struct hid_collection *parent; | |
| 430 | 434 | unsigned type; |
| 431 | 435 | unsigned usage; |
| 432 | 436 | unsigned level; |
| @@ -436,12 +440,16 @@ struct hid_usage { · 3 unmodified lines | ||
| 436 | 440 | unsigned hid; /* hid usage code */ |
| 437 | 441 | unsigned collection_index; /* index into collection array */ |
| 438 | 442 | unsigned usage_index; /* index into usage array */ |
| 443 | + __s8 resolution_multiplier;/* Effective Resolution Multiplier | |
| 444 | + (HUT v1.12, 4.3.1), default: 1 */ | |
| 439 | 445 | /* hidinput data */ |
| 446 | + __s8 wheel_factor; /* 120/resolution_multiplier */ | |
| 440 | 447 | __u16 code; /* input driver code */ |
| 441 | 448 | __u8 type; /* input driver type */ |
| 442 | 449 | __s8 hat_min; /* hat switch fun */ |
| 443 | 450 | __s8 hat_max; /* ditto */ |
| 444 | 451 | __s8 hat_dir; /* ditto */ |
| 452 | + __s16 wheel_accumulated; /* hi-res wheel */ | |
| 445 | 453 | }; |
| 446 | 454 | |
| 447 | 455 | struct hid_input; |
| @@ -650,6 +658,7 @@ struct hid_parser { · 202 unmodified lines | ||
| 650 | 658 | unsigned int *collection_stack; |
| 651 | 659 | unsigned int collection_stack_ptr; |
| 652 | 660 | unsigned int collection_stack_size; |
| 661 | + struct hid_collection *active_collection; | |
| 653 | 662 | struct hid_device *device; |
| 654 | 663 | unsigned int scan_flags; |
| 655 | 664 | }; |
| @@ -836,7 +845,11 @@ static inline bool hid_is_using_ll_driver(struct hid_device *hdev, · 180 unmodified lines | ||
| 836 | 845 | |
| 837 | 846 | /* Applications from HID Usage Tables 4/8/99 Version 1.1 */ |
| 838 | 847 | /* We ignore a few input applications that are not widely used */ |
| 839 | −#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || ((a >= 0x000d0002) && (a <= 0x000d0006))) | |
| 848 | +#define IS_INPUT_APPLICATION(a) \ | |
| 849 | + (((a >= HID_UP_GENDESK) && (a <= HID_GD_MULTIAXIS)) \ | |
| 850 | + || ((a >= HID_DG_PEN) && (a <= HID_DG_WHITEBOARD)) \ | |
| 851 | + || (a == HID_GD_SYSTEM_CONTROL) || (a == HID_CP_CONSUMER_CONTROL) \ | |
| 852 | + || (a == HID_GD_WIRELESS_RADIO_CTLS)) | |
| 840 | 853 | |
| 841 | 854 | /* HID core API */ |
| 842 | 855 | |
| @@ -892,6 +905,8 @@ struct hid_report *hid_validate_values(struct hid_device *hid, · 49 unmodified lines | ||
| 892 | 905 | unsigned int type, unsigned int id, |
| 893 | 906 | unsigned int field_index, |
| 894 | 907 | unsigned int report_counts); |
| 908 | + | |
| 909 | +void hid_setup_resolution_multiplier(struct hid_device *hid); | |
| 895 | 910 | int hid_open_report(struct hid_device *device); |
| 896 | 911 | int hid_check_keys_pressed(struct hid_device *hid); |
| 897 | 912 | int hid_connect(struct hid_device *hid, unsigned int connect_mask); |
| @@ -905,6 +905,13 @@ struct vmbus_channel { · 904 unmodified lines | ||
| 905 | 905 | |
| 906 | 906 | bool probe_done; |
| 907 | 907 | |
| 908 | + /* | |
| 909 | + * We must offload the handling of the primary/sub channels | |
| 910 | + * from the single-threaded vmbus_connection.work_queue to | |
| 911 | + * two different workqueue, otherwise we can block | |
| 912 | + * vmbus_connection.work_queue and hang: see vmbus_process_offer(). | |
| 913 | + */ | |
| 914 | + struct work_struct add_channel_work; | |
| 908 | 915 | }; |
| 909 | 916 | |
| 910 | 917 | static inline bool is_hvsock_channel(const struct vmbus_channel *c) |
| @@ -21,6 +21,7 @@ · 20 unmodified lines | ||
| 21 | 21 | #define PIT_LATCH ((PIT_TICK_RATE + HZ/2) / HZ) |
| 22 | 22 | |
| 23 | 23 | extern raw_spinlock_t i8253_lock; |
| 24 | +extern bool i8253_clear_counter_on_shutdown; | |
| 24 | 25 | extern struct clock_event_device i8253_clockevent; |
| 25 | 26 | extern void clockevent_i8253_init(bool oneshot); |
| 26 | 27 | |
| @@ -37,7 +37,9 @@ struct in_device { · 36 unmodified lines | ||
| 37 | 37 | unsigned long mr_v1_seen; |
| 38 | 38 | unsigned long mr_v2_seen; |
| 39 | 39 | unsigned long mr_maxdelay; |
| 40 | − unsigned char mr_qrv; | |
| 40 | + unsigned long mr_qi; /* Query Interval */ | |
| 41 | + unsigned long mr_qri; /* Query Response Interval */ | |
| 42 | + unsigned char mr_qrv; /* Query Robustness Variable */ | |
| 41 | 43 | unsigned char mr_gq_running; |
| 42 | 44 | unsigned char mr_ifc_count; |
| 43 | 45 | struct timer_list mr_gq_timer; /* general query timer */ |
| @@ -17,6 +17,9 @@ · 16 unmodified lines | ||
| 17 | 17 | |
| 18 | 18 | #ifdef CONFIG_KEYS |
| 19 | 19 | |
| 20 | +struct kernel_pkey_query; | |
| 21 | +struct kernel_pkey_params; | |
| 22 | + | |
| 20 | 23 | /* |
| 21 | 24 | * key under-construction record |
| 22 | 25 | * - passed to the request_key actor if supplied |
| @@ -155,6 +158,14 @@ struct key_type { · 132 unmodified lines | ||
| 155 | 158 | */ |
| 156 | 159 | struct key_restriction *(*lookup_restriction)(const char *params); |
| 157 | 160 | |
| 161 | + /* Asymmetric key accessor functions. */ | |
| 162 | + int (*asym_query)(const struct kernel_pkey_params *params, | |
| 163 | + struct kernel_pkey_query *info); | |
| 164 | + int (*asym_eds_op)(struct kernel_pkey_params *params, | |
| 165 | + const void *in, void *out); | |
| 166 | + int (*asym_verify_signature)(struct kernel_pkey_params *params, | |
| 167 | + const void *in, const void *in2); | |
| 168 | + | |
| 158 | 169 | /* internal fields */ |
| 159 | 170 | struct list_head link; /* link in types list */ |
| 160 | 171 | struct lock_class_key lock_class; /* key->sem lock class */ |
| @@ -0,0 +1,46 @@ | ||
| 1 | +/* keyctl kernel bits | |
| 2 | + * | |
| 3 | + * Copyright (C) 2016 Red Hat, Inc. All Rights Reserved. | |
| 4 | + * Written by David Howells (dhowells@redhat.com) | |
| 5 | + * | |
| 6 | + * This program is free software; you can redistribute it and/or | |
| 7 | + * modify it under the terms of the GNU General Public Licence | |
| 8 | + * as published by the Free Software Foundation; either version | |
| 9 | + * 2 of the Licence, or (at your option) any later version. | |
| 10 | + */ | |
| 11 | + | |
| 12 | +#ifndef __LINUX_KEYCTL_H | |
| 13 | +#define __LINUX_KEYCTL_H | |
| 14 | + | |
| 15 | +#include <uapi/linux/keyctl.h> | |
| 16 | + | |
| 17 | +struct kernel_pkey_query { | |
| 18 | + __u32 supported_ops; /* Which ops are supported */ | |
| 19 | + __u32 key_size; /* Size of the key in bits */ | |
| 20 | + __u16 max_data_size; /* Maximum size of raw data to sign in bytes */ | |
| 21 | + __u16 max_sig_size; /* Maximum size of signature in bytes */ | |
| 22 | + __u16 max_enc_size; /* Maximum size of encrypted blob in bytes */ | |
| 23 | + __u16 max_dec_size; /* Maximum size of decrypted blob in bytes */ | |
| 24 | +}; | |
| 25 | + | |
| 26 | +enum kernel_pkey_operation { | |
| 27 | + kernel_pkey_encrypt, | |
| 28 | + kernel_pkey_decrypt, | |
| 29 | + kernel_pkey_sign, | |
| 30 | + kernel_pkey_verify, | |
| 31 | +}; | |
| 32 | + | |
| 33 | +struct kernel_pkey_params { | |
| 34 | + struct key *key; | |
| 35 | + const char *encoding; /* Encoding (eg. "oaep" or "raw" for none) */ | |
| 36 | + const char *hash_algo; /* Digest algorithm used (eg. "sha1") or NULL if N/A */ | |
| 37 | + char *info; /* Modified info string to be released later */ | |
| 38 | + __u32 in_len; /* Input data size */ | |
| 39 | + union { | |
| 40 | + __u32 out_len; /* Output buffer size (enc/dec/sign) */ | |
| 41 | + __u32 in2_len; /* 2nd input data size (verify) */ | |
| 42 | + }; | |
| 43 | + enum kernel_pkey_operation op : 8; | |
| 44 | +}; | |
| 45 | + | |
| 46 | +#endif /* __LINUX_KEYCTL_H */ | |
| @@ -2473,14 +2473,15 @@ struct mlx5_ifc_xrc_srqc_bits { · 2472 unmodified lines | ||
| 2473 | 2473 | |
| 2474 | 2474 | u8 wq_signature[0x1]; |
| 2475 | 2475 | u8 cont_srq[0x1]; |
| 2476 | − u8 dbr_umem_valid[0x1]; | |
| 2476 | + u8 reserved_at_22[0x1]; | |
| 2477 | 2477 | u8 rlky[0x1]; |
| 2478 | 2478 | u8 basic_cyclic_rcv_wqe[0x1]; |
| 2479 | 2479 | u8 log_rq_stride[0x3]; |
| 2480 | 2480 | u8 xrcd[0x18]; |
| 2481 | 2481 | |
| 2482 | 2482 | u8 page_offset[0x6]; |
| 2483 | − u8 reserved_at_46[0x2]; | |
| 2483 | + u8 reserved_at_46[0x1]; | |
| 2484 | + u8 dbr_umem_valid[0x1]; | |
| 2484 | 2485 | u8 cqn[0x18]; |
| 2485 | 2486 | |
| 2486 | 2487 | u8 reserved_at_60[0x20]; |
| @@ -6689,9 +6690,12 @@ struct mlx5_ifc_create_xrc_srq_in_bits { · 4202 unmodified lines | ||
| 6689 | 6690 | |
| 6690 | 6691 | struct mlx5_ifc_xrc_srqc_bits xrc_srq_context_entry; |
| 6691 | 6692 | |
| 6692 | − u8 reserved_at_280[0x40]; | |
| 6693 | + u8 reserved_at_280[0x60]; | |
| 6694 | + | |
| 6693 | 6695 | u8 xrc_srq_umem_valid[0x1]; |
| 6694 | − u8 reserved_at_2c1[0x5bf]; | |
| 6696 | + u8 reserved_at_2e1[0x1f]; | |
| 6697 | + | |
| 6698 | + u8 reserved_at_300[0x580]; | |
| 6695 | 6699 | |
| 6696 | 6700 | u8 pas[0][0x40]; |
| 6697 | 6701 | }; |
| @@ -1744,11 +1744,15 @@ int __pud_alloc(struct mm_struct *mm, p4d_t *p4d, unsigned long address); · 1743 unmodified lines | ||
| 1744 | 1744 | |
| 1745 | 1745 | static inline void mm_inc_nr_puds(struct mm_struct *mm) |
| 1746 | 1746 | { |
| 1747 | + if (mm_pud_folded(mm)) | |
| 1748 | + return; | |
| 1747 | 1749 | atomic_long_add(PTRS_PER_PUD * sizeof(pud_t), &mm->pgtables_bytes); |
| 1748 | 1750 | } |
| 1749 | 1751 | |
| 1750 | 1752 | static inline void mm_dec_nr_puds(struct mm_struct *mm) |
| 1751 | 1753 | { |
| 1754 | + if (mm_pud_folded(mm)) | |
| 1755 | + return; | |
| 1752 | 1756 | atomic_long_sub(PTRS_PER_PUD * sizeof(pud_t), &mm->pgtables_bytes); |
| 1753 | 1757 | } |
| 1754 | 1758 | #endif |
| @@ -1768,11 +1772,15 @@ int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address); · 13 unmodified lines | ||
| 1768 | 1772 | |
| 1769 | 1773 | static inline void mm_inc_nr_pmds(struct mm_struct *mm) |
| 1770 | 1774 | { |
| 1775 | + if (mm_pmd_folded(mm)) | |
| 1776 | + return; | |
| 1771 | 1777 | atomic_long_add(PTRS_PER_PMD * sizeof(pmd_t), &mm->pgtables_bytes); |
| 1772 | 1778 | } |
| 1773 | 1779 | |
| 1774 | 1780 | static inline void mm_dec_nr_pmds(struct mm_struct *mm) |
| 1775 | 1781 | { |
| 1782 | + if (mm_pmd_folded(mm)) | |
| 1783 | + return; | |
| 1776 | 1784 | atomic_long_sub(PTRS_PER_PMD * sizeof(pmd_t), &mm->pgtables_bytes); |
| 1777 | 1785 | } |
| 1778 | 1786 | #endif |
| @@ -324,9 +324,8 @@ static inline unsigned int nanddev_ntargets(const struct nand_device *nand) · 323 unmodified lines | ||
| 324 | 324 | */ |
| 325 | 325 | static inline unsigned int nanddev_neraseblocks(const struct nand_device *nand) |
| 326 | 326 | { |
| 327 | − return (u64)nand->memorg.luns_per_target * | |
| 328 | − nand->memorg.eraseblocks_per_lun * | |
| 329 | − nand->memorg.pages_per_eraseblock; | |
| 327 | + return nand->memorg.ntargets * nand->memorg.luns_per_target * | |
| 328 | + nand->memorg.eraseblocks_per_lun; | |
| 330 | 329 | } |
| 331 | 330 | |
| 332 | 331 | /** |
| @@ -569,7 +568,7 @@ static inline void nanddev_pos_next_eraseblock(struct nand_device *nand, · 236 unmodified lines | ||
| 569 | 568 | } |
| 570 | 569 | |
| 571 | 570 | /** |
| 572 | − * nanddev_pos_next_eraseblock() - Move a position to the next page | |
| 571 | + * nanddev_pos_next_page() - Move a position to the next page | |
| 573 | 572 | * @nand: NAND device |
| 574 | 573 | * @pos: the position to update |
| 575 | 574 | * |
| @@ -406,6 +406,8 @@ static inline void net_dim(struct net_dim *dim, · 405 unmodified lines | ||
| 406 | 406 | } |
| 407 | 407 | /* fall through */ |
| 408 | 408 | case NET_DIM_START_MEASURE: |
| 409 | + net_dim_sample(end_sample.event_ctr, end_sample.pkt_ctr, end_sample.byte_ctr, | |
| 410 | + &dim->start_sample); | |
| 409 | 411 | dim->state = NET_DIM_MEASURE_IN_PROGRESS; |
| 410 | 412 | break; |
| 411 | 413 | case NET_DIM_APPLY_NEW_PROFILE: |
| @@ -3190,6 +3190,26 @@ static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue, · 3189 unmodified lines | ||
| 3190 | 3190 | #endif |
| 3191 | 3191 | } |
| 3192 | 3192 | |
| 3193 | +/* Variant of netdev_tx_sent_queue() for drivers that are aware | |
| 3194 | + * that they should not test BQL status themselves. | |
| 3195 | + * We do want to change __QUEUE_STATE_STACK_XOFF only for the last | |
| 3196 | + * skb of a batch. | |
| 3197 | + * Returns true if the doorbell must be used to kick the NIC. | |
| 3198 | + */ | |
| 3199 | +static inline bool __netdev_tx_sent_queue(struct netdev_queue *dev_queue, | |
| 3200 | + unsigned int bytes, | |
| 3201 | + bool xmit_more) | |
| 3202 | +{ | |
| 3203 | + if (xmit_more) { | |
| 3204 | +#ifdef CONFIG_BQL | |
| 3205 | + dql_queued(&dev_queue->dql, bytes); | |
| 3206 | +#endif | |
| 3207 | + return netif_tx_queue_stopped(dev_queue); | |
| 3208 | + } | |
| 3209 | + netdev_tx_sent_queue(dev_queue, bytes); | |
| 3210 | + return true; | |
| 3211 | +} | |
| 3212 | + | |
| 3193 | 3213 | /** |
| 3194 | 3214 | * netdev_sent_queue - report the number of bytes queued to hardware |
| 3195 | 3215 | * @dev: network device |
| @@ -314,7 +314,7 @@ enum { · 313 unmodified lines | ||
| 314 | 314 | extern ip_set_id_t ip_set_get_byname(struct net *net, |
| 315 | 315 | const char *name, struct ip_set **set); |
| 316 | 316 | extern void ip_set_put_byindex(struct net *net, ip_set_id_t index); |
| 317 | −extern const char *ip_set_name_byindex(struct net *net, ip_set_id_t index); | |
| 317 | +extern void ip_set_name_byindex(struct net *net, ip_set_id_t index, char *name); | |
| 318 | 318 | extern ip_set_id_t ip_set_nfnl_get_byindex(struct net *net, ip_set_id_t index); |
| 319 | 319 | extern void ip_set_nfnl_put(struct net *net, ip_set_id_t index); |
| 320 | 320 | |
| @@ -43,11 +43,11 @@ ip_set_init_comment(struct ip_set *set, struct ip_set_comment *comment, · 42 unmodified lines | ||
| 43 | 43 | rcu_assign_pointer(comment->c, c); |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | −/* Used only when dumping a set, protected by rcu_read_lock_bh() */ | |
| 46 | +/* Used only when dumping a set, protected by rcu_read_lock() */ | |
| 47 | 47 | static inline int |
| 48 | 48 | ip_set_put_comment(struct sk_buff *skb, const struct ip_set_comment *comment) |
| 49 | 49 | { |
| 50 | − struct ip_set_comment_rcu *c = rcu_dereference_bh(comment->c); | |
| 50 | + struct ip_set_comment_rcu *c = rcu_dereference(comment->c); | |
| 51 | 51 | |
| 52 | 52 | if (!c) |
| 53 | 53 | return 0; |
| @@ -21,6 +21,19 @@ struct nf_ct_gre_keymap { · 20 unmodified lines | ||
| 21 | 21 | struct nf_conntrack_tuple tuple; |
| 22 | 22 | }; |
| 23 | 23 | |
| 24 | +enum grep_conntrack { | |
| 25 | + GRE_CT_UNREPLIED, | |
| 26 | + GRE_CT_REPLIED, | |
| 27 | + GRE_CT_MAX | |
| 28 | +}; | |
| 29 | + | |
| 30 | +struct netns_proto_gre { | |
| 31 | + struct nf_proto_net nf; | |
| 32 | + rwlock_t keymap_lock; | |
| 33 | + struct list_head keymap_list; | |
| 34 | + unsigned int gre_timeouts[GRE_CT_MAX]; | |
| 35 | +}; | |
| 36 | + | |
| 24 | 37 | /* add new tuple->key_reply pair to keymap */ |
| 25 | 38 | int nf_ct_gre_keymap_add(struct nf_conn *ct, enum ip_conntrack_dir dir, |
| 26 | 39 | struct nf_conntrack_tuple *t); |
| @@ -119,6 +119,8 @@ static inline int hardlockup_detector_perf_init(void) { return 0; } · 118 unmodified lines | ||
| 119 | 119 | void watchdog_nmi_stop(void); |
| 120 | 120 | void watchdog_nmi_start(void); |
| 121 | 121 | int watchdog_nmi_probe(void); |
| 122 | +int watchdog_nmi_enable(unsigned int cpu); | |
| 123 | +void watchdog_nmi_disable(unsigned int cpu); | |
| 122 | 124 | |
| 123 | 125 | /** |
| 124 | 126 | * touch_nmi_watchdog - restart NMI watchdog timeout. |
| @@ -122,8 +122,7 @@ extern void srcu_init_notifier_head(struct srcu_notifier_head *nh); · 121 unmodified lines | ||
| 122 | 122 | |
| 123 | 123 | #ifdef CONFIG_TREE_SRCU |
| 124 | 124 | #define _SRCU_NOTIFIER_HEAD(name, mod) \ |
| 125 | − static DEFINE_PER_CPU(struct srcu_data, \ | |
| 126 | − name##_head_srcu_data); \ | |
| 125 | + static DEFINE_PER_CPU(struct srcu_data, name##_head_srcu_data); \ | |
| 127 | 126 | mod struct srcu_notifier_head name = \ |
| 128 | 127 | SRCU_NOTIFIER_INIT(name, name##_head_srcu_data) |
| 129 | 128 | |
| @@ -17,6 +17,8 @@ · 16 unmodified lines | ||
| 17 | 17 | #define __DAVINCI_GPIO_PLATFORM_H |
| 18 | 18 | |
| 19 | 19 | struct davinci_gpio_platform_data { |
| 20 | + bool no_auto_base; | |
| 21 | + u32 base; | |
| 20 | 22 | u32 ngpio; |
| 21 | 23 | u32 gpio_unbanked; |
| 22 | 24 | }; |
| @@ -1,6 +1,7 @@ | ||
| 1 | 1 | #ifndef _LINUX_PSI_H |
| 2 | 2 | #define _LINUX_PSI_H |
| 3 | 3 | |
| 4 | +#include <linux/jump_label.h> | |
| 4 | 5 | #include <linux/psi_types.h> |
| 5 | 6 | #include <linux/sched.h> |
| 6 | 7 | |
| @@ -9,7 +10,7 @@ struct css_set; · 2 unmodified lines | ||
| 9 | 10 | |
| 10 | 11 | #ifdef CONFIG_PSI |
| 11 | 12 | |
| 12 | −extern bool psi_disabled; | |
| 13 | +extern struct static_key_false psi_disabled; | |
| 13 | 14 | |
| 14 | 15 | void psi_init(void); |
| 15 | 16 | |
| @@ -90,7 +90,10 @@ struct pstore_record { · 89 unmodified lines | ||
| 90 | 90 | * |
| 91 | 91 | * @buf_lock: spinlock to serialize access to @buf |
| 92 | 92 | * @buf: preallocated crash dump buffer |
| 93 | − * @bufsize: size of @buf available for crash dump writes | |
| 93 | + * @bufsize: size of @buf available for crash dump bytes (must match | |
| 94 | + * smallest number of bytes available for writing to a | |
| 95 | + * backend entry, since compressed bytes don't take kindly | |
| 96 | + * to being truncated) | |
| 94 | 97 | * |
| 95 | 98 | * @read_mutex: serializes @open, @read, @close, and @erase callbacks |
| 96 | 99 | * @flags: bitfield of frontends the backend can accept writes for |
| @@ -64,15 +64,12 @@ extern void exit_ptrace(struct task_struct *tracer, struct list_head *dead); · 63 unmodified lines | ||
| 64 | 64 | #define PTRACE_MODE_NOAUDIT 0x04 |
| 65 | 65 | #define PTRACE_MODE_FSCREDS 0x08 |
| 66 | 66 | #define PTRACE_MODE_REALCREDS 0x10 |
| 67 | −#define PTRACE_MODE_SCHED 0x20 | |
| 68 | −#define PTRACE_MODE_IBPB 0x40 | |
| 69 | 67 | |
| 70 | 68 | /* shorthands for READ/ATTACH and FSCREDS/REALCREDS combinations */ |
| 71 | 69 | #define PTRACE_MODE_READ_FSCREDS (PTRACE_MODE_READ | PTRACE_MODE_FSCREDS) |
| 72 | 70 | #define PTRACE_MODE_READ_REALCREDS (PTRACE_MODE_READ | PTRACE_MODE_REALCREDS) |
| 73 | 71 | #define PTRACE_MODE_ATTACH_FSCREDS (PTRACE_MODE_ATTACH | PTRACE_MODE_FSCREDS) |
| 74 | 72 | #define PTRACE_MODE_ATTACH_REALCREDS (PTRACE_MODE_ATTACH | PTRACE_MODE_REALCREDS) |
| 75 | −#define PTRACE_MODE_SPEC_IBPB (PTRACE_MODE_ATTACH_REALCREDS | PTRACE_MODE_IBPB) | |
| 76 | 73 | |
| 77 | 74 | /** |
| 78 | 75 | * ptrace_may_access - check whether the caller is permitted to access |
| @@ -90,20 +87,6 @@ extern void exit_ptrace(struct task_struct *tracer, struct list_head *dead); · 11 unmodified lines | ||
| 90 | 87 | */ |
| 91 | 88 | extern bool ptrace_may_access(struct task_struct *task, unsigned int mode); |
| 92 | 89 | |
| 93 | −/** | |
| 94 | − * ptrace_may_access - check whether the caller is permitted to access | |
| 95 | − * a target task. | |
| 96 | − * @task: target task | |
| 97 | − * @mode: selects type of access and caller credentials | |
| 98 | − * | |
| 99 | − * Returns true on success, false on denial. | |
| 100 | − * | |
| 101 | − * Similar to ptrace_may_access(). Only to be called from context switch | |
| 102 | − * code. Does not call into audit and the regular LSM hooks due to locking | |
| 103 | − * constraints. | |
| 104 | − */ | |
| 105 | −extern bool ptrace_may_access_sched(struct task_struct *task, unsigned int mode); | |
| 106 | − | |
| 107 | 90 | static inline int ptrace_reparented(struct task_struct *child) |
| 108 | 91 | { |
| 109 | 92 | return !same_thread_group(child->real_parent, child->parent); |
| @@ -1116,6 +1116,7 @@ struct task_struct { · 1115 unmodified lines | ||
| 1116 | 1116 | #ifdef CONFIG_FUNCTION_GRAPH_TRACER |
| 1117 | 1117 | /* Index of current stored address in ret_stack: */ |
| 1118 | 1118 | int curr_ret_stack; |
| 1119 | + int curr_ret_depth; | |
| 1119 | 1120 | |
| 1120 | 1121 | /* Stack of return addresses for return function tracing: */ |
| 1121 | 1122 | struct ftrace_ret_stack *ret_stack; |
| @@ -1200,6 +1201,11 @@ struct task_struct { · 78 unmodified lines | ||
| 1200 | 1201 | void *security; |
| 1201 | 1202 | #endif |
| 1202 | 1203 | |
| 1204 | +#ifdef CONFIG_GCC_PLUGIN_STACKLEAK | |
| 1205 | + unsigned long lowest_stack; | |
| 1206 | + unsigned long prev_lowest_stack; | |
| 1207 | +#endif | |
| 1208 | + | |
| 1203 | 1209 | /* |
| 1204 | 1210 | * New fields for task_struct should be added above here, so that |
| 1205 | 1211 | * they are included in the randomized portion of task_struct. |
| @@ -1448,6 +1454,8 @@ static inline bool is_percpu_thread(void) · 242 unmodified lines | ||
| 1448 | 1454 | #define PFA_SPREAD_SLAB 2 /* Spread some slab caches over cpuset */ |
| 1449 | 1455 | #define PFA_SPEC_SSB_DISABLE 3 /* Speculative Store Bypass disabled */ |
| 1450 | 1456 | #define PFA_SPEC_SSB_FORCE_DISABLE 4 /* Speculative Store Bypass force disabled*/ |
| 1457 | +#define PFA_SPEC_IB_DISABLE 5 /* Indirect branch speculation restricted */ | |
| 1458 | +#define PFA_SPEC_IB_FORCE_DISABLE 6 /* Indirect branch speculation permanently restricted */ | |
| 1451 | 1459 | |
| 1452 | 1460 | #define TASK_PFA_TEST(name, func) \ |
| 1453 | 1461 | static inline bool task_##func(struct task_struct *p) \ |
| @@ -1479,6 +1487,13 @@ TASK_PFA_CLEAR(SPEC_SSB_DISABLE, spec_ssb_disable) · 25 unmodified lines | ||
| 1479 | 1487 | TASK_PFA_TEST(SPEC_SSB_FORCE_DISABLE, spec_ssb_force_disable) |
| 1480 | 1488 | TASK_PFA_SET(SPEC_SSB_FORCE_DISABLE, spec_ssb_force_disable) |
| 1481 | 1489 | |
| 1490 | +TASK_PFA_TEST(SPEC_IB_DISABLE, spec_ib_disable) | |
| 1491 | +TASK_PFA_SET(SPEC_IB_DISABLE, spec_ib_disable) | |
| 1492 | +TASK_PFA_CLEAR(SPEC_IB_DISABLE, spec_ib_disable) | |
| 1493 | + | |
| 1494 | +TASK_PFA_TEST(SPEC_IB_FORCE_DISABLE, spec_ib_force_disable) | |
| 1495 | +TASK_PFA_SET(SPEC_IB_FORCE_DISABLE, spec_ib_force_disable) | |
| 1496 | + | |
| 1482 | 1497 | static inline void |
| 1483 | 1498 | current_restore_flags(unsigned long orig_flags, unsigned long flags) |
| 1484 | 1499 | { |
| @@ -0,0 +1,20 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef _LINUX_SCHED_SMT_H | |
| 3 | +#define _LINUX_SCHED_SMT_H | |
| 4 | + | |
| 5 | +#include <linux/static_key.h> | |
| 6 | + | |
| 7 | +#ifdef CONFIG_SCHED_SMT | |
| 8 | +extern struct static_key_false sched_smt_present; | |
| 9 | + | |
| 10 | +static __always_inline bool sched_smt_active(void) | |
| 11 | +{ | |
| 12 | + return static_branch_likely(&sched_smt_present); | |
| 13 | +} | |
| 14 | +#else | |
| 15 | +static inline bool sched_smt_active(void) { return false; } | |
| 16 | +#endif | |
| 17 | + | |
| 18 | +void arch_smt_update(void); | |
| 19 | + | |
| 20 | +#endif | |
| @@ -224,7 +224,7 @@ struct sfp_eeprom_ext { · 223 unmodified lines | ||
| 224 | 224 | * |
| 225 | 225 | * See the SFF-8472 specification and related documents for the definition |
| 226 | 226 | * of these structure members. This can be obtained from |
| 227 | − * ftp://ftp.seagate.com/sff | |
| 227 | + * https://www.snia.org/technology-communities/sff/specifications | |
| 228 | 228 | */ |
| 229 | 229 | struct sfp_eeprom_id { |
| 230 | 230 | struct sfp_eeprom_base base; |
| @@ -1326,6 +1326,22 @@ static inline void skb_zcopy_set(struct sk_buff *skb, struct ubuf_info *uarg) · 1325 unmodified lines | ||
| 1326 | 1326 | } |
| 1327 | 1327 | } |
| 1328 | 1328 | |
| 1329 | +static inline void skb_zcopy_set_nouarg(struct sk_buff *skb, void *val) | |
| 1330 | +{ | |
| 1331 | + skb_shinfo(skb)->destructor_arg = (void *)((uintptr_t) val | 0x1UL); | |
| 1332 | + skb_shinfo(skb)->tx_flags |= SKBTX_ZEROCOPY_FRAG; | |
| 1333 | +} | |
| 1334 | + | |
| 1335 | +static inline bool skb_zcopy_is_nouarg(struct sk_buff *skb) | |
| 1336 | +{ | |
| 1337 | + return (uintptr_t) skb_shinfo(skb)->destructor_arg & 0x1UL; | |
| 1338 | +} | |
| 1339 | + | |
| 1340 | +static inline void *skb_zcopy_get_nouarg(struct sk_buff *skb) | |
| 1341 | +{ | |
| 1342 | + return (void *)((uintptr_t) skb_shinfo(skb)->destructor_arg & ~0x1UL); | |
| 1343 | +} | |
| 1344 | + | |
| 1329 | 1345 | /* Release a reference on a zerocopy structure */ |
| 1330 | 1346 | static inline void skb_zcopy_clear(struct sk_buff *skb, bool zerocopy) |
| 1331 | 1347 | { |
| @@ -1335,7 +1351,7 @@ static inline void skb_zcopy_clear(struct sk_buff *skb, bool zerocopy) · 3 unmodified lines | ||
| 1335 | 1351 | if (uarg->callback == sock_zerocopy_callback) { |
| 1336 | 1352 | uarg->zerocopy = uarg->zerocopy && zerocopy; |
| 1337 | 1353 | sock_zerocopy_put(uarg); |
| 1338 | − } else { | |
| 1354 | + } else if (!skb_zcopy_is_nouarg(skb)) { | |
| 1339 | 1355 | uarg->callback(uarg, zerocopy); |
| 1340 | 1356 | } |
| 1341 | 1357 | |
| @@ -0,0 +1,35 @@ | ||
| 1 | +/* SPDX-License-Identifier: GPL-2.0 */ | |
| 2 | +#ifndef _LINUX_STACKLEAK_H | |
| 3 | +#define _LINUX_STACKLEAK_H | |
| 4 | + | |
| 5 | +#include <linux/sched.h> | |
| 6 | +#include <linux/sched/task_stack.h> | |
| 7 | + | |
| 8 | +/* | |
| 9 | + * Check that the poison value points to the unused hole in the | |
| 10 | + * virtual memory map for your platform. | |
| 11 | + */ | |
| 12 | +#define STACKLEAK_POISON -0xBEEF | |
| 13 | +#define STACKLEAK_SEARCH_DEPTH 128 | |
| 14 | + | |
| 15 | +#ifdef CONFIG_GCC_PLUGIN_STACKLEAK | |
| 16 | +#include <asm/stacktrace.h> | |
| 17 | + | |
| 18 | +static inline void stackleak_task_init(struct task_struct *t) | |
| 19 | +{ | |
| 20 | + t->lowest_stack = (unsigned long)end_of_stack(t) + sizeof(unsigned long); | |
| 21 | +# ifdef CONFIG_STACKLEAK_METRICS | |
| 22 | + t->prev_lowest_stack = t->lowest_stack; | |
| 23 | +# endif | |
| 24 | +} | |
| 25 | + | |
| 26 | +#ifdef CONFIG_STACKLEAK_RUNTIME_DISABLE | |
| 27 | +int stack_erasing_sysctl(struct ctl_table *table, int write, | |
| 28 | + void __user *buffer, size_t *lenp, loff_t *ppos); | |
| 29 | +#endif | |
| 30 | + | |
| 31 | +#else /* !CONFIG_GCC_PLUGIN_STACKLEAK */ | |
| 32 | +static inline void stackleak_task_init(struct task_struct *t) { } | |
| 33 | +#endif | |
| 34 | + | |
| 35 | +#endif | |
| @@ -107,8 +107,8 @@ struct krb5_ctx { · 106 unmodified lines | ||
| 107 | 107 | u8 Ksess[GSS_KRB5_MAX_KEYLEN]; /* session key */ |
| 108 | 108 | u8 cksum[GSS_KRB5_MAX_KEYLEN]; |
| 109 | 109 | s32 endtime; |
| 110 | − u32 seq_send; | |
| 111 | − u64 seq_send64; | |
| 110 | + atomic_t seq_send; | |
| 111 | + atomic64_t seq_send64; | |
| 112 | 112 | struct xdr_netobj mech_used; |
| 113 | 113 | u8 initiator_sign[GSS_KRB5_MAX_KEYLEN]; |
| 114 | 114 | u8 acceptor_sign[GSS_KRB5_MAX_KEYLEN]; |
| @@ -118,9 +118,6 @@ struct krb5_ctx { · 3 unmodified lines | ||
| 118 | 118 | u8 acceptor_integ[GSS_KRB5_MAX_KEYLEN]; |
| 119 | 119 | }; |
| 120 | 120 | |
| 121 | −extern u32 gss_seq_send_fetch_and_inc(struct krb5_ctx *ctx); | |
| 122 | −extern u64 gss_seq_send64_fetch_and_inc(struct krb5_ctx *ctx); | |
| 123 | − | |
| 124 | 121 | /* The length of the Kerberos GSS token header */ |
| 125 | 122 | #define GSS_KRB5_TOK_HDR_LEN (16) |
| 126 | 123 | |
| @@ -72,7 +72,6 @@ xdr_buf_init(struct xdr_buf *buf, void *start, size_t len) · 71 unmodified lines | ||
| 72 | 72 | buf->head[0].iov_base = start; |
| 73 | 73 | buf->head[0].iov_len = len; |
| 74 | 74 | buf->tail[0].iov_len = 0; |
| 75 | − buf->bvec = NULL; | |
| 76 | 75 | buf->pages = NULL; |
| 77 | 76 | buf->page_len = 0; |
| 78 | 77 | buf->flags = 0; |
| @@ -196,6 +196,7 @@ struct tcp_sock { · 195 unmodified lines | ||
| 196 | 196 | u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */ |
| 197 | 197 | u32 lsndtime; /* timestamp of last sent data packet (for restart window) */ |
| 198 | 198 | u32 last_oow_ack_time; /* timestamp of last out-of-window ACK */ |
| 199 | + u32 compressed_ack_rcv_nxt; | |
| 199 | 200 | |
| 200 | 201 | u32 tsoffset; /* timestamp offset */ |
| 201 | 202 | |
| @@ -83,8 +83,8 @@ static inline int ptrace_report_syscall(struct pt_regs *regs) · 82 unmodified lines | ||
| 83 | 83 | * tracehook_report_syscall_entry - task is about to attempt a system call |
| 84 | 84 | * @regs: user register state of current task |
| 85 | 85 | * |
| 86 | − * This will be called if %TIF_SYSCALL_TRACE has been set, when the | |
| 87 | − * current task has just entered the kernel for a system call. | |
| 86 | + * This will be called if %TIF_SYSCALL_TRACE or %TIF_SYSCALL_EMU have been set, | |
| 87 | + * when the current task has just entered the kernel for a system call. | |
| 88 | 88 | * Full user register state is available here. Changing the values |
| 89 | 89 | * in @regs can affect the system call number and arguments to be tried. |
| 90 | 90 | * It is safe to block here, preventing the system call from beginning. |
| @@ -166,7 +166,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) · 165 unmodified lines | ||
| 166 | 166 | struct tracepoint_func *it_func_ptr; \ |
| 167 | 167 | void *it_func; \ |
| 168 | 168 | void *__data; \ |
| 169 | − int __maybe_unused idx = 0; \ | |
| 169 | + int __maybe_unused __idx = 0; \ | |
| 170 | 170 | \ |
| 171 | 171 | if (!(cond)) \ |
| 172 | 172 | return; \ |
| @@ -182,7 +182,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) · 9 unmodified lines | ||
| 182 | 182 | * doesn't work from the idle path. \ |
| 183 | 183 | */ \ |
| 184 | 184 | if (rcuidle) { \ |
| 185 | − idx = srcu_read_lock_notrace(&tracepoint_srcu); \ | |
| 185 | + __idx = srcu_read_lock_notrace(&tracepoint_srcu);\ | |
| 186 | 186 | rcu_irq_enter_irqson(); \ |
| 187 | 187 | } \ |
| 188 | 188 | \ |
| @@ -198,7 +198,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p) · 9 unmodified lines | ||
| 198 | 198 | \ |
| 199 | 199 | if (rcuidle) { \ |
| 200 | 200 | rcu_irq_exit_irqson(); \ |
| 201 | − srcu_read_unlock_notrace(&tracepoint_srcu, idx);\ | |
| 201 | + srcu_read_unlock_notrace(&tracepoint_srcu, __idx);\ | |
| 202 | 202 | } \ |
| 203 | 203 | \ |
| 204 | 204 | preempt_enable_notrace(); \ |
| @@ -556,6 +556,7 @@ extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx); · 555 unmodified lines | ||
| 556 | 556 | extern void tty_release_struct(struct tty_struct *tty, int idx); |
| 557 | 557 | extern int tty_release(struct inode *inode, struct file *filp); |
| 558 | 558 | extern void tty_init_termios(struct tty_struct *tty); |
| 559 | +extern void tty_save_termios(struct tty_struct *tty); | |
| 559 | 560 | extern int tty_standard_install(struct tty_driver *driver, |
| 560 | 561 | struct tty_struct *tty); |
| 561 | 562 | |
| @@ -21,15 +21,16 @@ struct kvec { · 20 unmodified lines | ||
| 21 | 21 | size_t iov_len; |
| 22 | 22 | }; |
| 23 | 23 | |
| 24 | −enum { | |
| 24 | +enum iter_type { | |
| 25 | 25 | ITER_IOVEC = 0, |
| 26 | 26 | ITER_KVEC = 2, |
| 27 | 27 | ITER_BVEC = 4, |
| 28 | 28 | ITER_PIPE = 8, |
| 29 | + ITER_DISCARD = 16, | |
| 29 | 30 | }; |
| 30 | 31 | |
| 31 | 32 | struct iov_iter { |
| 32 | − int type; | |
| 33 | + unsigned int type; | |
| 33 | 34 | size_t iov_offset; |
| 34 | 35 | size_t count; |
| 35 | 36 | union { |
| @@ -47,6 +48,41 @@ struct iov_iter { · 11 unmodified lines | ||
| 47 | 48 | }; |
| 48 | 49 | }; |
| 49 | 50 | |
| 51 | +static inline enum iter_type iov_iter_type(const struct iov_iter *i) | |
| 52 | +{ | |
| 53 | + return i->type & ~(READ | WRITE); | |
| 54 | +} | |
| 55 | + | |
| 56 | +static inline bool iter_is_iovec(const struct iov_iter *i) | |
| 57 | +{ | |
| 58 | + return iov_iter_type(i) == ITER_IOVEC; | |
| 59 | +} | |
| 60 | + | |
| 61 | +static inline bool iov_iter_is_kvec(const struct iov_iter *i) | |
| 62 | +{ | |
| 63 | + return iov_iter_type(i) == ITER_KVEC; | |
| 64 | +} | |
| 65 | + | |
| 66 | +static inline bool iov_iter_is_bvec(const struct iov_iter *i) | |
| 67 | +{ | |
| 68 | + return iov_iter_type(i) == ITER_BVEC; | |
| 69 | +} | |
| 70 | + | |
| 71 | +static inline bool iov_iter_is_pipe(const struct iov_iter *i) | |
| 72 | +{ | |
| 73 | + return iov_iter_type(i) == ITER_PIPE; | |
| 74 | +} | |
| 75 | + | |
| 76 | +static inline bool iov_iter_is_discard(const struct iov_iter *i) | |
| 77 | +{ | |
| 78 | + return iov_iter_type(i) == ITER_DISCARD; | |
| 79 | +} | |
| 80 | + | |
| 81 | +static inline unsigned char iov_iter_rw(const struct iov_iter *i) | |
| 82 | +{ | |
| 83 | + return i->type & (READ | WRITE); | |
| 84 | +} | |
| 85 | + | |
| 50 | 86 | /* |
| 51 | 87 | * Total number of bytes covered by an iovec. |
| 52 | 88 | * |
| @@ -74,7 +110,8 @@ static inline struct iovec iov_iter_iovec(const struct iov_iter *iter) · 21 unmodified lines | ||
| 74 | 110 | } |
| 75 | 111 | |
| 76 | 112 | #define iov_for_each(iov, iter, start) \ |
| 77 | − if (!((start).type & (ITER_BVEC | ITER_PIPE))) \ | |
| 113 | + if (iov_iter_type(start) == ITER_IOVEC || \ | |
| 114 | + iov_iter_type(start) == ITER_KVEC) \ | |
| 78 | 115 | for (iter = (start); \ |
| 79 | 116 | (iter).count && \ |
| 80 | 117 | ((iov = iov_iter_iovec(&(iter))), 1); \ |
| @@ -181,14 +218,15 @@ size_t copy_to_iter_mcsafe(void *addr, size_t bytes, struct iov_iter *i) · 100 unmodified lines | ||
| 181 | 218 | size_t iov_iter_zero(size_t bytes, struct iov_iter *); |
| 182 | 219 | unsigned long iov_iter_alignment(const struct iov_iter *i); |
| 183 | 220 | unsigned long iov_iter_gap_alignment(const struct iov_iter *i); |
| 184 | −void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov, | |
| 221 | +void iov_iter_init(struct iov_iter *i, unsigned int direction, const struct iovec *iov, | |
| 185 | 222 | unsigned long nr_segs, size_t count); |
| 186 | −void iov_iter_kvec(struct iov_iter *i, int direction, const struct kvec *kvec, | |
| 223 | +void iov_iter_kvec(struct iov_iter *i, unsigned int direction, const struct kvec *kvec, | |
| 187 | 224 | unsigned long nr_segs, size_t count); |
| 188 | −void iov_iter_bvec(struct iov_iter *i, int direction, const struct bio_vec *bvec, | |
| 225 | +void iov_iter_bvec(struct iov_iter *i, unsigned int direction, const struct bio_vec *bvec, | |
| 189 | 226 | unsigned long nr_segs, size_t count); |
| 190 | −void iov_iter_pipe(struct iov_iter *i, int direction, struct pipe_inode_info *pipe, | |
| 227 | +void iov_iter_pipe(struct iov_iter *i, unsigned int direction, struct pipe_inode_info *pipe, | |
| 191 | 228 | size_t count); |
| 229 | +void iov_iter_discard(struct iov_iter *i, unsigned int direction, size_t count); | |
| 192 | 230 | ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages, |
| 193 | 231 | size_t maxsize, unsigned maxpages, size_t *start); |
| 194 | 232 | ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages, |
| @@ -202,19 +240,6 @@ static inline size_t iov_iter_count(const struct iov_iter *i) · 7 unmodified lines | ||
| 202 | 240 | return i->count; |
| 203 | 241 | } |
| 204 | 242 | |
| 205 | −static inline bool iter_is_iovec(const struct iov_iter *i) | |
| 206 | −{ | |
| 207 | − return !(i->type & (ITER_BVEC | ITER_KVEC | ITER_PIPE)); | |
| 208 | −} | |
| 209 | − | |
| 210 | −/* | |
| 211 | − * Get one of READ or WRITE out of iter->type without any other flags OR'd in | |
| 212 | − * with it. | |
| 213 | − * | |
| 214 | − * The ?: is just for type safety. | |
| 215 | − */ | |
| 216 | −#define iov_iter_rw(i) ((0 ? (struct iov_iter *)0 : (i))->type & (READ | WRITE)) | |
| 217 | − | |
| 218 | 243 | /* |
| 219 | 244 | * Cap the iov_iter by given limit; note that the second argument is |
| 220 | 245 | * *not* the new size - it's upper limit for such. Passing it a value |
| @@ -407,11 +407,11 @@ struct usb_host_bos { · 406 unmodified lines | ||
| 407 | 407 | }; |
| 408 | 408 | |
| 409 | 409 | int __usb_get_extra_descriptor(char *buffer, unsigned size, |
| 410 | − unsigned char type, void **ptr); | |
| 410 | + unsigned char type, void **ptr, size_t min); | |
| 411 | 411 | #define usb_get_extra_descriptor(ifpoint, type, ptr) \ |
| 412 | 412 | __usb_get_extra_descriptor((ifpoint)->extra, \ |
| 413 | 413 | (ifpoint)->extralen, \ |
| 414 | − type, (void **)ptr) | |
| 414 | + type, (void **)ptr, sizeof(**(ptr))) | |
| 415 | 415 | |
| 416 | 416 | /* ----------------------------------------------------------------------- */ |
| 417 | 417 | |
| @@ -66,4 +66,7 @@ · 65 unmodified lines | ||
| 66 | 66 | /* Device needs a pause after every control message. */ |
| 67 | 67 | #define USB_QUIRK_DELAY_CTRL_MSG BIT(13) |
| 68 | 68 | |
| 69 | +/* Hub needs extra delay after resetting its port. */ | |
| 70 | +#define USB_QUIRK_HUB_SLOW_RESET BIT(14) | |
| 71 | + | |
| 69 | 72 | #endif /* __LINUX_USB_QUIRKS_H */ |
| @@ -246,8 +246,7 @@ static inline void wbc_attach_fdatawrite_inode(struct writeback_control *wbc, · 245 unmodified lines | ||
| 246 | 246 | * |
| 247 | 247 | * @bio is a part of the writeback in progress controlled by @wbc. Perform |
| 248 | 248 | * writeback specific initialization. This is used to apply the cgroup |
| 249 | − * writeback context. Must be called after the bio has been associated with | |
| 250 | − * a device. | |
| 249 | + * writeback context. | |
| 251 | 250 | */ |
| 252 | 251 | static inline void wbc_init_bio(struct writeback_control *wbc, struct bio *bio) |
| 253 | 252 | { |
| @@ -258,7 +257,7 @@ static inline void wbc_init_bio(struct writeback_control *wbc, struct bio *bio) · 4 unmodified lines | ||
| 258 | 257 | * regular writeback instead of writing things out itself. |
| 259 | 258 | */ |
| 260 | 259 | if (wbc->wb) |
| 261 | − bio_associate_blkg_from_css(bio, wbc->wb->blkcg_css); | |
| 260 | + bio_associate_blkcg(bio, wbc->wb->blkcg_css); | |
| 262 | 261 | } |
| 263 | 262 | |
| 264 | 263 | #else /* CONFIG_CGROUP_WRITEBACK */ |
| @@ -289,9 +289,7 @@ struct xarray { · 288 unmodified lines | ||
| 289 | 289 | void xa_init_flags(struct xarray *, gfp_t flags); |
| 290 | 290 | void *xa_load(struct xarray *, unsigned long index); |
| 291 | 291 | void *xa_store(struct xarray *, unsigned long index, void *entry, gfp_t); |
| 292 | −void *xa_cmpxchg(struct xarray *, unsigned long index, | |
| 293 | − void *old, void *entry, gfp_t); | |
| 294 | −int xa_reserve(struct xarray *, unsigned long index, gfp_t); | |
| 292 | +void *xa_erase(struct xarray *, unsigned long index); | |
| 295 | 293 | void *xa_store_range(struct xarray *, unsigned long first, unsigned long last, |
| 296 | 294 | void *entry, gfp_t); |
| 297 | 295 | bool xa_get_mark(struct xarray *, unsigned long index, xa_mark_t); |
| @@ -343,65 +341,6 @@ static inline bool xa_marked(const struct xarray *xa, xa_mark_t mark) · 45 unmodified lines | ||
| 343 | 341 | return xa->xa_flags & XA_FLAGS_MARK(mark); |
| 344 | 342 | } |
| 345 | 343 | |
| 346 | −/** | |
| 347 | − * xa_erase() - Erase this entry from the XArray. | |
| 348 | − * @xa: XArray. | |
| 349 | − * @index: Index of entry. | |
| 350 | − * | |
| 351 | − * This function is the equivalent of calling xa_store() with %NULL as | |
| 352 | − * the third argument. The XArray does not need to allocate memory, so | |
| 353 | − * the user does not need to provide GFP flags. | |
| 354 | − * | |
| 355 | − * Context: Process context. Takes and releases the xa_lock. | |
| 356 | − * Return: The entry which used to be at this index. | |
| 357 | − */ | |
| 358 | −static inline void *xa_erase(struct xarray *xa, unsigned long index) | |
| 359 | −{ | |
| 360 | − return xa_store(xa, index, NULL, 0); | |
| 361 | −} | |
| 362 | − | |
| 363 | −/** | |
| 364 | − * xa_insert() - Store this entry in the XArray unless another entry is | |
| 365 | − * already present. | |
| 366 | − * @xa: XArray. | |
| 367 | − * @index: Index into array. | |
| 368 | − * @entry: New entry. | |
| 369 | − * @gfp: Memory allocation flags. | |
| 370 | − * | |
| 371 | − * If you would rather see the existing entry in the array, use xa_cmpxchg(). | |
| 372 | − * This function is for users who don't care what the entry is, only that | |
| 373 | − * one is present. | |
| 374 | − * | |
| 375 | − * Context: Process context. Takes and releases the xa_lock. | |
| 376 | − * May sleep if the @gfp flags permit. | |
| 377 | − * Return: 0 if the store succeeded. -EEXIST if another entry was present. | |
| 378 | − * -ENOMEM if memory could not be allocated. | |
| 379 | − */ | |
| 380 | −static inline int xa_insert(struct xarray *xa, unsigned long index, | |
| 381 | − void *entry, gfp_t gfp) | |
| 382 | −{ | |
| 383 | − void *curr = xa_cmpxchg(xa, index, NULL, entry, gfp); | |
| 384 | − if (!curr) | |
| 385 | − return 0; | |
| 386 | − if (xa_is_err(curr)) | |
| 387 | − return xa_err(curr); | |
| 388 | − return -EEXIST; | |
| 389 | −} | |
| 390 | − | |
| 391 | −/** | |
| 392 | − * xa_release() - Release a reserved entry. | |
| 393 | − * @xa: XArray. | |
| 394 | − * @index: Index of entry. | |
| 395 | − * | |
| 396 | − * After calling xa_reserve(), you can call this function to release the | |
| 397 | − * reservation. If the entry at @index has been stored to, this function | |
| 398 | − * will do nothing. | |
| 399 | − */ | |
| 400 | −static inline void xa_release(struct xarray *xa, unsigned long index) | |
| 401 | −{ | |
| 402 | − xa_cmpxchg(xa, index, NULL, NULL, 0); | |
| 403 | −} | |
| 404 | − | |
| 405 | 344 | /** |
| 406 | 345 | * xa_for_each() - Iterate over a portion of an XArray. |
| 407 | 346 | * @xa: XArray. |
| @@ -455,6 +394,7 @@ void *__xa_store(struct xarray *, unsigned long index, void *entry, gfp_t); · 47 unmodified lines | ||
| 455 | 394 | void *__xa_cmpxchg(struct xarray *, unsigned long index, void *old, |
| 456 | 395 | void *entry, gfp_t); |
| 457 | 396 | int __xa_alloc(struct xarray *, u32 *id, u32 max, void *entry, gfp_t); |
| 397 | +int __xa_reserve(struct xarray *, unsigned long index, gfp_t); | |
| 458 | 398 | void __xa_set_mark(struct xarray *, unsigned long index, xa_mark_t); |
| 459 | 399 | void __xa_clear_mark(struct xarray *, unsigned long index, xa_mark_t); |
| 460 | 400 | |
| @@ -486,6 +426,58 @@ static inline int __xa_insert(struct xarray *xa, unsigned long index, · 25 unmodified lines | ||
| 486 | 426 | return -EEXIST; |
| 487 | 427 | } |
| 488 | 428 | |
| 429 | +/** | |
| 430 | + * xa_store_bh() - Store this entry in the XArray. | |
| 431 | + * @xa: XArray. | |
| 432 | + * @index: Index into array. | |
| 433 | + * @entry: New entry. | |
| 434 | + * @gfp: Memory allocation flags. | |
| 435 | + * | |
| 436 | + * This function is like calling xa_store() except it disables softirqs | |
| 437 | + * while holding the array lock. | |
| 438 | + * | |
| 439 | + * Context: Any context. Takes and releases the xa_lock while | |
| 440 | + * disabling softirqs. | |
| 441 | + * Return: The entry which used to be at this index. | |
| 442 | + */ | |
| 443 | +static inline void *xa_store_bh(struct xarray *xa, unsigned long index, | |
| 444 | + void *entry, gfp_t gfp) | |
| 445 | +{ | |
| 446 | + void *curr; | |
| 447 | + | |
| 448 | + xa_lock_bh(xa); | |
| 449 | + curr = __xa_store(xa, index, entry, gfp); | |
| 450 | + xa_unlock_bh(xa); | |
| 451 | + | |
| 452 | + return curr; | |
| 453 | +} | |
| 454 | + | |
| 455 | +/** | |
| 456 | + * xa_store_irq() - Erase this entry from the XArray. | |
| 457 | + * @xa: XArray. | |
| 458 | + * @index: Index into array. | |
| 459 | + * @entry: New entry. | |
| 460 | + * @gfp: Memory allocation flags. | |
| 461 | + * | |
| 462 | + * This function is like calling xa_store() except it disables interrupts | |
| 463 | + * while holding the array lock. | |
| 464 | + * | |
| 465 | + * Context: Process context. Takes and releases the xa_lock while | |
| 466 | + * disabling interrupts. | |
| 467 | + * Return: The entry which used to be at this index. | |
| 468 | + */ | |
| 469 | +static inline void *xa_store_irq(struct xarray *xa, unsigned long index, | |
| 470 | + void *entry, gfp_t gfp) | |
| 471 | +{ | |
| 472 | + void *curr; | |
| 473 | + | |
| 474 | + xa_lock_irq(xa); | |
| 475 | + curr = __xa_store(xa, index, entry, gfp); | |
| 476 | + xa_unlock_irq(xa); | |
| 477 | + | |
| 478 | + return curr; | |
| 479 | +} | |
| 480 | + | |
| 489 | 481 | /** |
| 490 | 482 | * xa_erase_bh() - Erase this entry from the XArray. |
| 491 | 483 | * @xa: XArray. |
| @@ -495,7 +487,7 @@ static inline int __xa_insert(struct xarray *xa, unsigned long index, · 3 unmodified lines | ||
| 495 | 487 | * the third argument. The XArray does not need to allocate memory, so |
| 496 | 488 | * the user does not need to provide GFP flags. |
| 497 | 489 | * |
| 498 | − * Context: Process context. Takes and releases the xa_lock while | |
| 490 | + * Context: Any context. Takes and releases the xa_lock while | |
| 499 | 491 | * disabling softirqs. |
| 500 | 492 | * Return: The entry which used to be at this index. |
| 501 | 493 | */ |
| @@ -534,6 +526,61 @@ static inline void *xa_erase_irq(struct xarray *xa, unsigned long index) · 32 unmodified lines | ||
| 534 | 526 | return entry; |
| 535 | 527 | } |
| 536 | 528 | |
| 529 | +/** | |
| 530 | + * xa_cmpxchg() - Conditionally replace an entry in the XArray. | |
| 531 | + * @xa: XArray. | |
| 532 | + * @index: Index into array. | |
| 533 | + * @old: Old value to test against. | |
| 534 | + * @entry: New value to place in array. | |
| 535 | + * @gfp: Memory allocation flags. | |
| 536 | + * | |
| 537 | + * If the entry at @index is the same as @old, replace it with @entry. | |
| 538 | + * If the return value is equal to @old, then the exchange was successful. | |
| 539 | + * | |
| 540 | + * Context: Any context. Takes and releases the xa_lock. May sleep | |
| 541 | + * if the @gfp flags permit. | |
| 542 | + * Return: The old value at this index or xa_err() if an error happened. | |
| 543 | + */ | |
| 544 | +static inline void *xa_cmpxchg(struct xarray *xa, unsigned long index, | |
| 545 | + void *old, void *entry, gfp_t gfp) | |
| 546 | +{ | |
| 547 | + void *curr; | |
| 548 | + | |
| 549 | + xa_lock(xa); | |
| 550 | + curr = __xa_cmpxchg(xa, index, old, entry, gfp); | |
| 551 | + xa_unlock(xa); | |
| 552 | + | |
| 553 | + return curr; | |
| 554 | +} | |
| 555 | + | |
| 556 | +/** | |
| 557 | + * xa_insert() - Store this entry in the XArray unless another entry is | |
| 558 | + * already present. | |
| 559 | + * @xa: XArray. | |
| 560 | + * @index: Index into array. | |
| 561 | + * @entry: New entry. | |
| 562 | + * @gfp: Memory allocation flags. | |
| 563 | + * | |
| 564 | + * If you would rather see the existing entry in the array, use xa_cmpxchg(). | |
| 565 | + * This function is for users who don't care what the entry is, only that | |
| 566 | + * one is present. | |
| 567 | + * | |
| 568 | + * Context: Process context. Takes and releases the xa_lock. | |
| 569 | + * May sleep if the @gfp flags permit. | |
| 570 | + * Return: 0 if the store succeeded. -EEXIST if another entry was present. | |
| 571 | + * -ENOMEM if memory could not be allocated. | |
| 572 | + */ | |
| 573 | +static inline int xa_insert(struct xarray *xa, unsigned long index, | |
| 574 | + void *entry, gfp_t gfp) | |
| 575 | +{ | |
| 576 | + void *curr = xa_cmpxchg(xa, index, NULL, entry, gfp); | |
| 577 | + if (!curr) | |
| 578 | + return 0; | |
| 579 | + if (xa_is_err(curr)) | |
| 580 | + return xa_err(curr); | |
| 581 | + return -EEXIST; | |
| 582 | +} | |
| 583 | + | |
| 537 | 584 | /** |
| 538 | 585 | * xa_alloc() - Find somewhere to store this entry in the XArray. |
| 539 | 586 | * @xa: XArray. |
| @@ -575,7 +622,7 @@ static inline int xa_alloc(struct xarray *xa, u32 *id, u32 max, void *entry, · 35 unmodified lines | ||
| 575 | 622 | * Updates the @id pointer with the index, then stores the entry at that |
| 576 | 623 | * index. A concurrent lookup will not see an uninitialised @id. |
| 577 | 624 | * |
| 578 | − * Context: Process context. Takes and releases the xa_lock while | |
| 625 | + * Context: Any context. Takes and releases the xa_lock while | |
| 579 | 626 | * disabling softirqs. May sleep if the @gfp flags permit. |
| 580 | 627 | * Return: 0 on success, -ENOMEM if memory allocation fails or -ENOSPC if |
| 581 | 628 | * there is no more space in the XArray. |
| @@ -621,6 +668,98 @@ static inline int xa_alloc_irq(struct xarray *xa, u32 *id, u32 max, void *entry, · 39 unmodified lines | ||
| 621 | 668 | return err; |
| 622 | 669 | } |
| 623 | 670 | |
| 671 | +/** | |
| 672 | + * xa_reserve() - Reserve this index in the XArray. | |
| 673 | + * @xa: XArray. | |
| 674 | + * @index: Index into array. | |
| 675 | + * @gfp: Memory allocation flags. | |
| 676 | + * | |
| 677 | + * Ensures there is somewhere to store an entry at @index in the array. | |
| 678 | + * If there is already something stored at @index, this function does | |
| 679 | + * nothing. If there was nothing there, the entry is marked as reserved. | |
| 680 | + * Loading from a reserved entry returns a %NULL pointer. | |
| 681 | + * | |
| 682 | + * If you do not use the entry that you have reserved, call xa_release() | |
| 683 | + * or xa_erase() to free any unnecessary memory. | |
| 684 | + * | |
| 685 | + * Context: Any context. Takes and releases the xa_lock. | |
| 686 | + * May sleep if the @gfp flags permit. | |
| 687 | + * Return: 0 if the reservation succeeded or -ENOMEM if it failed. | |
| 688 | + */ | |
| 689 | +static inline | |
| 690 | +int xa_reserve(struct xarray *xa, unsigned long index, gfp_t gfp) | |
| 691 | +{ | |
| 692 | + int ret; | |
| 693 | + | |
| 694 | + xa_lock(xa); | |
| 695 | + ret = __xa_reserve(xa, index, gfp); | |
| 696 | + xa_unlock(xa); | |
| 697 | + | |
| 698 | + return ret; | |
| 699 | +} | |
| 700 | + | |
| 701 | +/** | |
| 702 | + * xa_reserve_bh() - Reserve this index in the XArray. | |
| 703 | + * @xa: XArray. | |
| 704 | + * @index: Index into array. | |
| 705 | + * @gfp: Memory allocation flags. | |
| 706 | + * | |
| 707 | + * A softirq-disabling version of xa_reserve(). | |
| 708 | + * | |
| 709 | + * Context: Any context. Takes and releases the xa_lock while | |
| 710 | + * disabling softirqs. | |
| 711 | + * Return: 0 if the reservation succeeded or -ENOMEM if it failed. | |
| 712 | + */ | |
| 713 | +static inline | |
| 714 | +int xa_reserve_bh(struct xarray *xa, unsigned long index, gfp_t gfp) | |
| 715 | +{ | |
| 716 | + int ret; | |
| 717 | + | |
| 718 | + xa_lock_bh(xa); | |
| 719 | + ret = __xa_reserve(xa, index, gfp); | |
| 720 | + xa_unlock_bh(xa); | |
| 721 | + | |
| 722 | + return ret; | |
| 723 | +} | |
| 724 | + | |
| 725 | +/** | |
| 726 | + * xa_reserve_irq() - Reserve this index in the XArray. | |
| 727 | + * @xa: XArray. | |
| 728 | + * @index: Index into array. | |
| 729 | + * @gfp: Memory allocation flags. | |
| 730 | + * | |
| 731 | + * An interrupt-disabling version of xa_reserve(). | |
| 732 | + * | |
| 733 | + * Context: Process context. Takes and releases the xa_lock while | |
| 734 | + * disabling interrupts. | |
| 735 | + * Return: 0 if the reservation succeeded or -ENOMEM if it failed. | |
| 736 | + */ | |
| 737 | +static inline | |
| 738 | +int xa_reserve_irq(struct xarray *xa, unsigned long index, gfp_t gfp) | |
| 739 | +{ | |
| 740 | + int ret; | |
| 741 | + | |
| 742 | + xa_lock_irq(xa); | |
| 743 | + ret = __xa_reserve(xa, index, gfp); | |
| 744 | + xa_unlock_irq(xa); | |
| 745 | + | |
| 746 | + return ret; | |
| 747 | +} | |
| 748 | + | |
| 749 | +/** | |
| 750 | + * xa_release() - Release a reserved entry. | |
| 751 | + * @xa: XArray. | |
| 752 | + * @index: Index of entry. | |
| 753 | + * | |
| 754 | + * After calling xa_reserve(), you can call this function to release the | |
| 755 | + * reservation. If the entry at @index has been stored to, this function | |
| 756 | + * will do nothing. | |
| 757 | + */ | |
| 758 | +static inline void xa_release(struct xarray *xa, unsigned long index) | |
| 759 | +{ | |
| 760 | + xa_cmpxchg(xa, index, NULL, NULL, 0); | |
| 761 | +} | |
| 762 | + | |
| 624 | 763 | /* Everything below here is the Advanced API. Proceed with caution. */ |
| 625 | 764 | |
| 626 | 765 | /* |